• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HF Design Pattern - Abstract Factory and Factory Method Pattern

 
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Does your book cover Abstract Factory and Factory Method Pattern with a real world example as all the design pattern books i have read so far have not done a good job of providing clear explanation and example, at least to me. I am looking for the situation each one these patterns is required and disadvantage if these patterns are not used in those situation.
thanks.
-Tulsi
 
author
Posts: 200
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tulsi,

We do cover Abstract Factory and Factory Method in the Factory chapter (chapter 4). We have an example that starts simple (with Simple Factory) and is used throughout the rest of the chapter, and we modify it as we go along to show the use of the factories.

It's a pizza shop example - so, if you mean by "real world" an example that computes payroll or similar ( ) then no, it's not "real world" - but it is pretty in-depth and hopefully will give you a good idea of how the factory patterns work. We start by simply providing a way to make different kinds of pizzas (Simple Factory). From there we show how you can gain the benefit of shared code and easily extend and change your pizza factory, by using Factory Method. Then for Abstract Factory, we show how you might want to break up the process of making a pizza and be able to specify how to put different ingredients together depending on which style of pizza you're making.

At the end of the chapter, there is a fireside chat between Factory Method and Abstract Factory that discusses when each is appropriate, as well as a two-page diagram that shows what each pattern is and the differences between them.

Let me know if you read this chapter and have any feedback about it.

Thanks!

Elisabeth
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

At the end of the chapter, there is a fireside chat between Factory Method and Abstract Factory that discusses when each is appropriate, as well as a two-page diagram that shows what each pattern is and the differences between them.



That is great! Search this forum and you will lot of posts comparing the the above two patterns.
 
I love a woman who dresses in stainless steel ... and carries tiny ads:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic