Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HF Design Pattern - Abstract Factory and Factory Method Pattern

 
Brian Smith
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • 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
 
Elisabeth Robson
author
Ranch Hand
Posts: 173
6
  • Mark post as helpful
  • send pies
  • 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
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic