I have five sources of data and all those are text files.
I would like to create an interface like IDatabase so that I can put as many source files I can get in any moment.
But... the files are like:
File1: name, age
File2: age, city
File3: name, parent_name, city
File4: city, genre, name
File5: city, country, height, weight, t_shirt_size
So, if I create a single interface, some concrete classes will have useless methods because some files doesn't have some kind of data. File1 has name and age but File2 doesn't has name, but has age.
At the same moment some data are shared among some files, which means different interfaces would lead to code duplication, or, in the best case, lead to tiny interfaces only to deal with shared data, like the name field.
Interface segregation is the most common answer when I ask to my friends, but if I segregate everything... at the end the number of interfaces and its names will make my system more confuse than clear.
I'm pretty sure there's a direct solution to create a good interface project to my situation.
Thanks for any help!
Aucun commentaire:
Enregistrer un commentaire