Skip to Content.
Sympa Menu

gang-of-4-patterns - [gang-of-4-patterns] Abstract Factory vs. Factory Method and related questions

gang-of-4-patterns AT lists.cs.illinois.edu

Subject: Design Patterns discussion

List archive

[gang-of-4-patterns] Abstract Factory vs. Factory Method and related questions


Chronological Thread 
  • From: "Sujee" <sujee68jan AT yahoo.com.sg>
  • To: <gang-of-4-patterns AT cs.uiuc.edu>
  • Subject: [gang-of-4-patterns] Abstract Factory vs. Factory Method and related questions
  • Date: Sat, 17 Dec 2005 20:30:44 -0600
  • Importance: Normal
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/gang-of-4-patterns>
  • List-id: Design Patterns discussion <gang-of-4-patterns.cs.uiuc.edu>

Hi,

 

  1. I have been trying to understand how these two patterns differ. I guess it is possible that in factory method, creator class can have multiple create methods to create related products with different abstract base classes. The only difference I can see is that in case of abstract factory only one instance of the one concrete factory is used by the application at a given time. In case of factory method usually there are several concrete creators simultaneously and one concrete creator is selected by another class, configuration or user. So it is correct to say that abstract factory is a special (degenerate) case of factory method?

 

  1. In each section of the book, the patterns are divided into two groups (e.g. object creational and class creational). For example, the abstract factory is object creational while factory method is class creational. What is the difference?

 

  1. One pattern I have seen often is a set of creators (e.g. “shape factories” supplied by different dlls) and the creator used at a given time depends on a menu selection or some other message. Can this be considered as factory method? Is this a common variation? Here the exact concrete factory used can be decided through a map or by giving each factory a beat at the message. What is the best place to keep the set of concrete factories? Singleton in the base class or on the client side?

 

Thank you,

Jeevaka

 



  • [gang-of-4-patterns] Abstract Factory vs. Factory Method and related questions, Sujee, 12/17/2005

Archive powered by MHonArc 2.6.16.

Top of Page