Example:
Say i have a car, i need to create a different objects by their make (Honda / Toyota), model (each make has a different list of item ) and trim (each model might have a list of trims or IT MIGHT NOT as in some of my cases. There might be cars that have only Make.
In terms of inheriting code, basic functionality of car remains the same, but different makes can have different features added on top of it.
Instead of using factory with if / else cases i am looking for a good pattern to organize the code and reuse methods when they are similar instead of rewriting them ...
In my use case, there can be hundreds of each of these items with different functionalities.
I am looking for code a good structure and any best practice / design pattern to handle such cases ...
Aucun commentaire:
Enregistrer un commentaire