lundi 1 février 2016

Is the factory pattern what I need?

I'm just wanting some clarity on my thinking before I start building something. I'm building an importer and the importer will always accept the following data:

[SKU, Name, Color plus 243 others]

However, the data sent to the importer could use different column names and in different file formats (CSV or excel plus others) because of the vendor. So do I need to create some sort of mapper to say X column means X column in my DB?

I'm thinking the best way to do this is to build an interface which then each vendor has its own implementation of it that contains a column name mapper then uses a factory pattern to build the final object.

I could be totally wrong, so has anyone had experience with building such things and what did you use?

Thanks Oli

Aucun commentaire:

Enregistrer un commentaire