Basically I need to have a flexible design to process. Im thinking of something like this:
- Have an Interface
DataProcessor
and then have concrete classes of different types likeCSVDataProcessor
,FTPDataProcessor
,CloudDataProcessor
. - All DataProcessor classes will implement a method
process()
defined onDataProcessor
Interface
My question is:
What should be the best design to do it, if each concrete class needs different parameters to execute the process()
method. For example, FTPDataProcessor
will need parameters like the file, the host, the port - CSVDataProcessor
will need the file location, and schema - CloudDataProcessor
will need the endpoint service, user, password??
My first thoughts are, to use the constructor to pass the specific requirements to each concrete class, but what if there are a lot of parameters that are needed?
In the future, more DataProcessor
concrete implementations will be added, and that is why I would like to have a very flexible design to implement it since the beginning.
Aucun commentaire:
Enregistrer un commentaire