mardi 23 juin 2015

best way to implement an abstract factory that can create a huge amount of different products

The question title describes the problem but to be more specific suppose we have a 1000+ different products that have a similar nature (no, I'm not kidding.) but creating a class with 1000+ virtual functions and in turn 1000+ factory methods doesn't sound very attractive because it makes the code ugly and difficult to maintain and in long run as more objects are added, it might cause redundancy because keeping track of that many things in a list is humanly impossible. I would appreciate if the solutions are provided in C++ language because this is the target language for implementation. Also I don't think this question is subjective or opinion based because I'm sure someone out in the wild has already encountered this and possibly have suggested a design pattern for the same of which my (lack of) Internet search skills and impatience combined did not help in finding it.

Aucun commentaire:

Enregistrer un commentaire