• 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

factory and abstract factory

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the difference between factory and abstract facory (or idea behind factory vs abstract factory)?

Thanks,
Dave
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have a look at the following discussions:
Builder Pattern Question
abstract and abstract factory
Abstract Factory vs Factory pattern
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'll assume by factory you mean Factory Method. A Factory Method can return different concrete types based on any kind of internal logic. I use them to get the proper strategy based on a product type:

That will give me some variety of pricing strategy for a toaster. I might get a different one for a blender. PricingStrategy is probably an interface here.

Abstract factory gets you a whole factory again based on some logic. The factory creates a family of related things. Different factory implementations give you different families. They might use more Factory Methods or just plain creator methods.


I think these patterns are poorly named and fussy in their definitions. I might even have gotten some of the details wrong because I don't strive to adhere to them perfectly. Ilja will let us know.
 
Dave Chawan
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks guys for clarifying this.

I really appreciate it.

Dave
 
when your children are suffering from your punishment, tell your them it will help them write good poetry when they are older. Like this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic