simple factory good:1 devide implementation and initialization2 use config file can make system more flexible (reflection) bad:1 all initialization work in factory. when the logic is complex or too many products, the factory will be too complex. hard…
I ran into a question on stackoverflow the other day that sort of shocked me. It was a piece of code, with the author asking why it wasn't a factory pattern. The thing that shocked me was that the pattern that everyone was agreeing was a factory meth…
Q: What is a Design Pattern? A: Design Patterns represent solutions to problems what arise when developing software within a particular context. Each pattern describes a problem which occurs over and over again in our environment, and then describes…
Factory, Abstract factory, prototype pattern (B) What are design patterns? (A) Can you explain factory pattern? (I) Can you explain abstract factory pattern? (I)Can you explain builder pattern? (I) Can you explain prototype pattern? (A) Can you expla…
Layering & Contract Philosophy With additional indirection Factory Method The example code is as following: class CProduct //interface declaration class CConcreteProductOne: public CProduct; class CConcreteProductTwo: public CProduct; class CCreator…