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.

Required fields*

4
  • "However, such a factory must know all involved derived types beforehand, which is not always possible." Both factories must know the involved objects in order to write the instantiation code. Commented Feb 24, 2020 at 9:35
  • @AsierNaiz No. The AbstractFactory allows you to add new bicycle types without changing the implementation. I added some clarification to the answer. Commented Feb 24, 2020 at 9:39
  • As fas as I understood, there should be a simple factory implementation somewhere even if you use factory method or abstract factory. Otherwise, how would they know which factory type to instantiate? Hiding that part of the code when talking about facotry method (and abstract factory) makes this comparison very confusing. Commented May 28, 2020 at 7:19
  • @ΕГИІИО The SimpleFactory is already implemented in the question. No need to copy that. Commented May 29, 2020 at 9:07