This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes OO, Patterns, UML and Refactoring and the fly likes design patterns Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "design patterns" Watch "design patterns" New topic
Author

design patterns

Tayal Rohit
Greenhorn

Joined: Feb 18, 2005
Posts: 12
What is the difference between factory design pattern and abstract factory design pattern, please elaborate with examples too.

thanks
Ellen Zhao
Ranch Hand

Joined: Sep 17, 2002
Posts: 581
By using factory pattern, you are using a subclass to do object creation. Clients only see the superclass and no need to worry what is really created at run time. In abstract pattern, the abstract type creats a family of products. Compared to factory pattern, the abstract factory pattern groups a set of realted products together. You can take it this way, abstract factory pattern is bigger than factory pattern. You can often see methods of an abstract factory are implemented as factory methods.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Scroll on down to the OO, UML, Patterns, etc. forum. We had a thread on this not long ago. See ya there!


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

And indeed, that's the forum in which this question belongs; I will move it there for you.


[Jess in Action][AskingGoodQuestions]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: design patterns
 
Similar Threads
Abstract Factor / Factory Method / Factory
Design pattern in SAX parser.
Java Pattern
what's the factory?
interface creates instance for desired class