If you’ve had a hard time learning design patterns you’re not alone. Since 1995 when the Gang of Four coined the term nothing else in the programming world has caused more headaches. Although the ideas presented were groundbreaking, many people were left in the dark by the technical writing, not being quite sure how to implement the depth of knowledge within. The Head First series is unlike any other programming books you’ve ever read. Rather than paragraph after paragraph of text, this series uses images, conversation, questions, diagrams, emotions and much more to get the users attention and keep it. There isn’t a page in the entire book of plain text. Java is used for code examples throughout the book, starting at the most basic syntax and expanding on it. In addition to learning patterns, you get a basic understanding of Java here as well.
In order to throttle the flow of knowledge in both cases, code is always limited to a single page, and always with comments written on the side rather than the typical //inline comments. They stand out much more because of this, making the meaning and the code itself read by different parts of your brain. The end result of all this is that instead of just throwing out a load of design patterns and possibly remembering one or two, but to learn everything possible. Does it work? That will depend on how this book is read. Throughout the book there are exercises, so have a pencil handy. These could be coding simple classes, UML like designs, mapping vocabulary to definition or even crossword puzzles. These are very well paced to where if you’re reading and taking in the book you’ll be able to do these without a problem.
Although chapters bounce around between stimuli, the book is well structured. Each design pattern has its own chapter (occasionally two patterns will share a chapter). It begins with some problem and works it up to the point where there is a possible solution, although not the best one. At this point it asks the reader “can you think of a better way” in some form, and proceeds to shows how the pattern of that chapter could help out. Sometimes it’ll do this twice in chapter, giving multiple routes to learning the same information.
After 11 chapters of patterns, we take a turn to patterns of patterns. This is a quick way of throwing everything leaned up until this point together in one super application. Although it isn’t a real world situation, its a great brush up on all the patterns before going into the famous Model-View-Controller pattern. In the past when shown what MVC is it’s always been presented to me as Model = Business Logic, V = all display, C = single point of contact for code. Head First takes a different approach by explaining what design patterns make up Model View Controller. They do so for both a simple Java application and a JSP webpage, which translates to just about any other web programming medium. They even have a MVC song !
Overall I’ve been pleasantly impressed by this one. There were days reading it when I simply couldn’t put it down. I’d heard strong recommendations from the Helms and Peters podcast , the What’s on your bookshelf segment in Fusion Authority Fall 2006 and Peter Bell . I’ll agree with them all and say this is a powerful book. They do go into the upsides and the downsides of using patterns, repeatedly stating how patterns are not a “solution”, merely a means to an end and that the easiest solution to a problem should be the one taken. If you’re interested in learning some design patterns, this is a great place to start!