File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "design patterns" Watch "design patterns" New topic

design patterns

Tayal Rohit

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

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

Joined: Jul 08, 2003
Posts: 24199

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

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: design patterns
It's not a secret anymore!