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