CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Ben Reichelt's Weblog


Head First Design Pattern Question



Comments

breichelt said:

Interesting, I have to go back and look at that chapter again, its been awhile since I read that one, I'll report back :-)
# May 24, 2005 5:40 AM

GooberDLX said:

first: i love the book, great way to introduce patterns to a developer...

second: i think it was merely an example of the factory pattern. straight up. just as in actual development, there are also a million ways to describe the same thing.
# May 24, 2005 6:41 AM

darrell said:

I think Thomas is right about the "last-resort" thing. Decorator ends up having tons of wrappers, and in their example you'd have to do a lot of work to re-order the coffee decorators to say "double-mocha" whereas if you had developed it differently, double-mocha is easy.
# May 24, 2005 7:45 AM

Jason said:

You could use a decorator pattern to encapsulate the pizza toppings if you wanted to.

The point of the factory is that the assembling of the class is encapsulated by the factory, so you could swap one factory for another.
# June 20, 2005 11:43 AM
Check out Devlicio.us!

Our Sponsors