Skip to Content.
Sympa Menu

gang-of-4-patterns - Re: [gang-of-4-patterns] Question on Abstract Factory

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

Subject: Design Patterns discussion

List archive

Re: [gang-of-4-patterns] Question on Abstract Factory


Chronological Thread 
  • From: "Clint Shank" <clintshank AT hotmail.com>
  • To: sayanmukherjee AT indiatimes.com, gang-of-4-patterns AT cs.uiuc.edu
  • Subject: Re: [gang-of-4-patterns] Question on Abstract Factory
  • Date: Fri, 29 Aug 2003 12:38:28 -0400
  • List-archive: <http://mail.cs.uiuc.edu/pipermail/gang-of-4-patterns/>
  • List-id: Design Patterns discussion <gang-of-4-patterns.cs.uiuc.edu>

I don't have my book on hand, but I think it says (or should say) that client code won't instantiate objects directly like this:

ProductA = new Product1A();

Instead, you do:

ProductA = factory.createProductA();

The point is that you won't have to go through you client code and change all the direct instantiations when you want to switch product families. Just the factory object used changes.

Clint Shank


From: "Sayan Mukherjee"
<sayanmukherjee AT indiatimes.com>
Reply-To: "Sayan
Mukherjee"<sayanmukherjee AT indiatimes.com>
To:
<gang-of-4-patterns AT cs.uiuc.edu>
Subject: [gang-of-4-patterns] Question on Abstract Factory
Date: Fri, 29 Aug 2003 18:17:18 +0530

Hi,

In the Design Patterns book by GoF, it says that
the reference to the AbstractProduct (or
ConcreteProduct) never occurs in the client code.
Clients will only call the CreateXXX() methods
from the concrete factory classes.

Then how will the client use the objects that the CreateXXX() methods construct?

I am assuming the following relationships:

AbsractFactory (interface)
CreateProductA() (signature only)
CreateProductB() ( -do- )

ConcreteFactory1 (class) implements AbsractFactory
Implementations of the CreateXXX() methods
are here.
Supposed to create Product1A and Product1B
objects.

ConcreteFactory2 (class) implements AbsractFactory
Implementations of the CreateXXX() methods are
here.
Supposed to create Product2A and Product2B
objects.

Sayan Mukherjee
[Email:
sayanmukherjee AT indiatimes.com]



Get Your Private, Free E-mail from Indiatimes at http://email.indiatimes.com

Buy The Best In BOOKS at http://www.bestsellers.indiatimes.com

Bid for for Air Tickets @ Re.1 on Air Sahara Flights. Just log on to http://airsahara.indiatimes.com and Bid Now !

_______________________________________________
gang-of-4-patterns mailing list
gang-of-4-patterns AT cs.uiuc.edu
http://mail.cs.uiuc.edu/mailman/listinfo/gang-of-4-patterns

_________________________________________________________________
Help protect your PC: Get a free online virus scan at McAfee.com. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963





Archive powered by MHonArc 2.6.16.

Top of Page