A Funny Java Flavoured Look at the World

Wednesday, May 24, 2006

Head First Design Patterns - free pdf Decorator chapter

I noticed that the Head First Design Patterns book has a free chapter on the Decorator pattern. I actually own the Head First Design patterns book but because this chapter was free I read it again.

The decorator pattern is quite a peculiar pattern to look at, it almost works as if by magic, it has a kind of beauty that tends to come from simple idea which is incredible effective .

The decorator pattern should in theory be quite simple to understand e.g. it decorates an object with some functionality, it does what it says on the tin. In reality the code didn't seem that simple to me and I had to read it and the examples about three times. This chapter helped a lot because the examples were fantastic and they were worked was amazing but then reading the explanation and reasoning took me a while to understand how the code work.

so if like me you half understood the decorator pattern then read this chapter I think it will help you a lot. Of course it's a free pdf on the Decorator pattern so it's well worth downloading for later use.

The chapter is always very good because it shows how some initial code worked and then how they refactored it to use the Decorator pattern. This is a very good application of the decorator pattern and in a similar scenario to many of the people reading the chapter.

I almost forgot to actually past the link so here it is

http://www.oreilly.com/catalog/hfdesignpat/chapter/ch03.pdf

Once again if you don't own this book its well worth the investment and really helped explain the tricky world of design patterns using easy to follow and amusing examples.

0 Comments:

Post a Comment

<< Home