Link to home
Start Free TrialLog in
Avatar of jaggernat
jaggernat

asked on

factory v/s abstract factory

hi experts



i want to know what exactly is difference between "factory design pattern" and abstract factory design pattern"


is it true that abstract factory and factory design patterns are used to gether, and factory design pattern instantiates
abstract factory design pattern.

a short n clear description would greatly help..

please do not redirect me to websites such as      http://c2.com/cgi/wiki?AbstractFactoryVsFactoryMethod

i just need a clear picture of whats going on..

thanks in advance,
J
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Abstract Factory - provide an interface for crreating families of related or dependant objects without specifying their concrete classes

Factory Metod - define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.
Avatar of jaggernat
jaggernat

ASKER

can you please give a short example.

thanks for prompt res,
J
AF - a gui toolkit could use this pattern to create widgets, the abstract factory would define methods for creating various types of widgets avaiolable. Each L&F (eg. Windows, Motif) would provide an implementation of this factory to return the widget subclass for that l&f thus making the client independant of the l&f

FM - an application framework that deals with different document types. In this case the particulkar Document type to create is application specific and the framework has no way of knowing what type of document is to be created (it only knows about abstract document class). So instead application subclasses redefine the factory method to return the appropriate document subclass.
>> please do not redirect me to websites such as      

I could've copy-pasted the whole stuff, but actually there's good explanation there :)
"provide an interface for crreating families of related or dependant objects without specifying their concrete classes"

That's why i told you earlier (largely ignored) your abstract soup factory should not be instantiating (or promising to instantiate) concrete soups
ASKER CERTIFIED SOLUTION
Avatar of sanjusk
sanjusk

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I thought objects also deserved some points here.
is it? my appologies to you( and objects) if i was wrong in judging points. actually the pdf which sanjusk gave me was clear with easy to understand examples.

thanks
J