• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

design patterns

 
Tayal Rohit
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the difference between factory design pattern and abstract factory design pattern, please elaborate with examples too.

thanks
 
Ellen Zhao
Ranch Hand
Posts: 581
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Scroll on down to the OO, UML, Patterns, etc. forum. We had a thread on this not long ago. See ya there!
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And indeed, that's the forum in which this question belongs; I will move it there for you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic