Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

8
  • ' The Design Patterns book which introduced this pattern '- are you talking about thye book by GoF here amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/…? Commented Oct 25, 2018 at 12:48
  • The definition from OP says :' The Factory Method Pattern defines an interface for creating an object, but lets subclasses decide which class to instantiate. ' It could make thing more clear by saying ' but if there are any subclasses then lets subclasses decide which class to instantiate ', right ? Commented Oct 25, 2018 at 12:57
  • @IstiaqueAhmed Yes. The Head First book tries to explain the GoF Design Patterns in a more accessible manner, but doesn't always succeed. (This doesn't mean you should get the GoF book. I found it interesting from a historical perspective and it contains good advice. But it's now 20 years old and shows it age. Some of the patterns are now considered antipatterns, and the code examples are only given in old-school C++ and in Smalltalk (an effectively extinct language).) Commented Oct 25, 2018 at 13:02
  • recommendation of any book to learn design pattern easily ? Or is such question not a good fit here ? Commented Oct 25, 2018 at 13:06
  • @IstiaqueAhmed I find the original phrasing unambiguous, but your clarified definition is correct. A lot of design patterns are about offering extension points in advance so that a subclass can be implemented in the future. Commented Oct 25, 2018 at 13:06