Registered: Jun 2001
Head First Design Patterns
Perhaps the subtitle on this book should read "Patterns for the Rest of Us".
The newest in the immensely successful Head First series published by O'Reilly, Design Patterns is written in the same tradition. If you haven't yet read one of these books, it really is a must. Kathy Sierra, founder of javaranch.com and author of several Java Certification Exams, pioneered the innovative presentation methods in these books based on research into learning theory. The basic approach is highly visual, frequently with fewer words on a page than pictures or drawings.
Design patterns is a difficult discipline, and the masterpiece that started the patterns movement, Design Patterns by Erich Gamma, et.al., is notoriously complex and has many of its examples in C++ or Smalltalk. Although there have been many attempts to emulate the original, virtually all fall short.
Head First Design Patterns, authored by Elisabeth Freeman and Eric Freeman, because of its copious and engaging Java examples and clear pictures, is therefore a breakthrough, making this difficult topic accessible to many more programmers. What is also impressive about this book is the many discussions on object-oriented design principles, such as encapsulation, inheritance, coupling, delegation, the open/closed principle and many others. Some of the Java examples include software for a pizza store and a coffee shop.
One problem I did find with the book is the example for the Decorator pattern, where condiments are used to decorate beverages such as coffee or tea. Although the example succeeds in teaching the basic principles of the Decorator pattern, one is struck by the fact that condiments are really attributes of a beverage, not a beverage themselves. The behavior of the condiments Decorator classes ends up being too simplistic to warrant being their own classes. This seems especially true when comparing this example with the authors' real-world example of the Java I/O classes, which indeed are classic examples of the Decorator pattern, and which do in fact add behavior in the process of decoration. The reader is highly encouraged to look at the Java source code for these classes, which may be found in Sun's JDK.
The description of the Template Method pattern on the other hand is very clear and convincing. The example here is... you guessed it, a coffee/tea making application, with abstract, template methods for brew() and addCondiments(), thereby allowing one base class to prepare both recipes, even though each recipe is specialized by these two methods. (It is clear from this example that a better abstraction for condiments is as attributes of a beverage.) The real-world example for this pattern is the sort method for the Java Arrays class, in this case used to sort ducks by weight.
The strong point of this book is the clear descriptions of many of the most popular patterns and their applicability to solving real-world software problems. I highly recommend it to any developers who want to put patterns to work in their own software.
If you haven't seen the other books in the Head First series, I also highly recommend the JSP and Servlets book, as well as the one on EJB.
My recommendation for a new Head First book? How about Head First Agile Software Development?
Last edited by wellington on 12-27-2004 at 02:05 AM
Report this post to a moderator | IP: Logged