I know there are a lot of questions out there about differences of different factory patterns, but the answers are so different and confusing. The books that i read use unclear and (over)simplified examples. I have a number of questions even after reading Wikipedia explanations, and a lot of online explanations about them including all on these site. The book that I'm currently reading is Head First Design Patterns.
In Simple Factory the client uses separate class (Creator) with factory method (which CAN be static) to return Products.
In Factory Method Pattern the Creator and the Client are the same thing and they use abstract method in the same class to create new Products, on which they operate in that same class. Of course the Creator (or Client) are abstract, so the decision about making the Concrete Product is deferred to sub-classes.
Is my understanding correct (for ex. are the Client and Creator in FMP the same thing, I never see Client in FMP diagram)?
In Factory Method Pattern it seams that the create method is not reusable outside of the Creator, so it can only be reused when making some new Creator?
What are the situations where I can choose one over the other?
(P.S. Please don't mark this as duplicate, I want to make this thing clear on this site)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…