This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

When to use Factory and when to use AbstractFactory ?

 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I was going through the factory and abstract factory design patterns... Both patterns looks similar, both are used for object creation.

When to use Factory Pattern & When to use Abstract Factory ?

I am still little confused about AbstractFactory pattern. What is the relation of AbstractFactory and Factory Pattern ?

 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
AbstractFactory implementations may consist of a way to obtain multiple "concrete" factories which then are used to create similiar but different objects. It is a more complex implementation than using a simplified Factory Method implementation.

The decision to use one or the other depends upon (1) your understanding of the patterns and their various applications, and (2) the needs the application you are designing, or in other words the requirements.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic