Skip to Content.
Sympa Menu

gang-of-4-patterns - RE: [gang-of-4-patterns] Doubt on Abstract Factory pattern.

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

Subject: Design Patterns discussion

List archive

RE: [gang-of-4-patterns] Doubt on Abstract Factory pattern.


Chronological Thread 
  • From: "Keith Nicholas" <keithn AT compacsort.com>
  • To: <rajesh AT cs.iitm.ernet.in>, <gang-of-4-patterns AT cs.uiuc.edu>
  • Subject: RE: [gang-of-4-patterns] Doubt on Abstract Factory pattern.
  • Date: Tue, 9 Dec 2003 18:15:44 +1300
  • Importance: Normal
  • List-archive: <http://mail.cs.uiuc.edu/pipermail/gang-of-4-patterns/>
  • List-id: Design Patterns discussion <gang-of-4-patterns.cs.uiuc.edu>

You may well be able to infer the information from the code. In fact
your abstract factory could use reflection to work out what objects to
create.

The family of objects is arbitrary. You get to decide what a "family of
related objects" is. If you wanted to infer it from the code, in C# you
could use attributes and reflection to find the right classes to create
instead of using inheritance. But that's more of a implementation issue.

The point of an abstract factory is that it creates the correct concrete
classes for the "family" of objects you have decided your factory should
produce.

Eg.....relating it to real car factories....

You have a class "FamilyVehicle" and "SportsVehicle"

CarFactory abstractFactory = new ToyotaFactory();
abstractFactory.createFamilyVehichle(); // will create the toyota
family vehicle

You don't need to know your dealing with a Toyota factory. All you need
to know is your dealing with a Car Factory and that it will produce
"family cars" and "sports cars" if you ask it to.


Keith





> -----Original Message-----
> From:
> gang-of-4-patterns-admin AT cs.uiuc.edu
>
> [mailto:gang-of-4-patterns-admin AT cs.uiuc.edu]
> On Behalf Of
> rajesh AT cs.iitm.ernet.in
> Sent: Tuesday, 9 December 2003 5:38 a.m.
> To:
> gang-of-4-patterns AT cs.uiuc.edu
> Subject: [gang-of-4-patterns] Doubt on Abstract Factory pattern.
>
>
> Hello,
>
> I have a basic doubt on Abstract factory pattern. Abstract factory
> Provides an interface for creating family of related or
> dependent objects. How do objects are related? I mean , does
> this relation is conceptual
> relation or it is a physical relation(Programatically there exist a
> relation among the family of objects)?
>
> Given two product classes say , Motifwindow, Motifscrollbar.
> Conceptually
> they belong to the product family Motifwidget.
> Is it possible to infer this information from the code?.
>
> Looking forward for reply.
>
> Regards
> rajesh
>
>
> --
>
>
>
> _______________________________________________
> 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
>





Archive powered by MHonArc 2.6.16.

Top of Page