• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:

Abstract Factory pattern

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need clear explanation and examples on Abstract Factory pattern.
And what is the difference between Factory Method pattern and Abstract Factory Pattern?
thanks in advance.
 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by suriapps suriapps:
I need clear explanation and examples on Abstract Factory pattern.
And what is the difference between Factory Method pattern and Abstract Factory Pattern?
thanks in advance.


Factory pattern is all about delegating the creation of a specific type to a derived class.Abastract factory is used to provide interface for the clients to get products related to each other.
For Ex.
SupplyCarParts(abstract factory) can have methods like
Engine getEngine();
Body getBody();
Wheels getWheel();
Automobile manufacurerA implements methods in SupplyCarParts to return EngineA(a subclass of Engine),BodyA(a subclass of Body),WheelsA(a subclass of Weels) for building carA.
Automobile manufacurerB implements methods in SupplyCarParts to return Engine(another subclass of Engine),BodyB(another subclass of Body),,Wheels(another subclass of Weels) for building carB.
By using an abstract factory you ensure the clients for manufacuterA get only parts for carA and not engine of carA and body of carB.
Implementation of methods in the abstract factory interface can be done in factoy methods.
Hope this helps
 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In simple words, "AbstractFactory is the Factory of Factories".
 
william kane
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Mahesh Chalil:
In simple words, "AbstractFactory is the Factory of Factories".


Even more precisely "An abstract factory is a Factory of Factories churing out related products"
 
That new kid is a freak. Show him this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic