esa-esdl/esdl-core

Extract similar/dublicated code from source provider implementations

Closed this issue · 5 comments

The cube source provider implementations that are currently used to convert raster data sources have a lot in common. Therefore it is important that we extract similar/dublicated code in order to increase code maintenance, understandability, clarity, and ability to unit-test and decrease complexity and overall number of lines of code.

This would be a great idea. Can we use interfaces/abstract classes to implement this? I don't know if this is crazy, but we can get so far that you can define a provider as:

class MyNewProvider(BaseCubeSourceProvider, AggregateMean, InterpolateBicubic, ...)

not having to write any code at all if the data is in NetCDF files in a single folder....

Yes and no!

  1. No, because https://en.wikipedia.org/wiki/Composition_over_inheritance
  2. Yes, because AggregateMean, InterpolateBicubic may be implementations of interfaces that are the components with which our future providers may be composed of.

I was also thinking along the lines of interfaces and not strict inheritance. Thanks for the link though it was an intersting read. I am still trying to get my mind into OOP, which is quite hard for me...

Added mustfix because code becomes unmaintainable!

in progress on branch 'issue_14'