Enter your mobile number or email address below and we'll send you a link to download the free Kindle App. Then you can start reading Kindle books on your smartphone, tablet, or computer - no Kindle device required.
To get the free app, enter your mobile phone number.
Holub on Patterns: Learning Design Patterns by Looking at Code (Books for Professionals by Professionals) Hardcover – September 28, 2004
Customers Who Bought This Item Also Bought
About the Author
Allen Holub is a design consultant, programmer, educator, and author specializing in object-oriented design, Java, C++, and systems programming. He is a contributing editor for JavaWorld, and a popular columnist appearing in many computer magazines, including Dr. Dobb's Journal and Microsoft Systems Journal.
Top Customer Reviews
The book is basically a commentary on the Gang of Four. It's certainly not the first, but it has a unique format. He demonstrates all 23 of the GoF patterns by applying them to two modest-sized Java applications. This is great for people who need concrete code to see what the pattern really means. It's even better because it shows multiple patterns overlapping, where one application class has different duties in the different classes. A large part of the book's bulk is code listings for the applications - some classes exceed 1000 lines of source code. I normally consider that to be a waste of paper. This time, however, the code is complex enough that it really does need to be presented right next to the commentary. (The code is also available electronically at holub.com .)
Towards the end of the book, he says "So, that's all of the Gang of Four design patterns, all tangled together in the two programs ... the way the patterns appear in the real world ..." That tang of realism is what gives this book such an unfamiliar format, and gives such contrast to the standard, one-at-a-time reductionist descriptions of each pattern in isolation. I'm not saying this holist approach is better; a beginner will just get lost in the whirl. Holub's holism isn't worse, either, it's a complement to the microscopic, academic presentations seen elsewhere. This book plus the analytic pattern catalogs form a sum much more valuable than the parts.
I recommend this very highly. The successful reader already is already quite familiar with Java and with design patterns. That reader is ready to take the next step, from the theory of patterns into their practical application. Seasoned pros may not get much form this book. An advanced beginner, with a little determination to see it through, will get a lot.
The volume is structured in 4 chapters. The first one contains some 'preliminaries'. Meaning : short explanations about why OOP is still incorrectly used, design patterns are not fully understood, plus a bonus of controversial statements like 'getters and setters are evil' and 'Swing is an over-engineered piece of junk' [well, maybe not exactly these words]. As a direct consequence of reading this chapter, the 'intermediates' will start banging their heads on the closest wall available : "My code sucks ! I swear I'll never blindly copy/paste again !".
In the second chapter things really start to heat up. Allen explains why 'extends is evil' and interfaces are not evil. In case we needed an example of fragile-base-class problem, here we go with some MFC bashing (usual stuff). The chapter focuses also on some creational patterns such as Factory and (at great lenghts) Singleton. I especially liked the cool explanations of how to shut down a Singleton.
The third chapter discusses an [overly complex, on purpose] implementation of the 'Game of Life'. Between huge chunks of code (a bit much for my taste) scattered throughout the chapter, the author explains all the implementation choices: from Visitor to Flyweight. Some 60% of the GoF patterns are encountered in this chapter's code.
The fourth and last chapter contains 'production code', as the author declares. It's a small in-memory database, with and embedded SQL interpreter and a JDBC driver. Very solid example, but it'll probably scare away a few 'intermediates'.
It all ends with an Appendix containing a great 'Design-Pattern Quick Reference', presenting the most used patterns in a very pragmatic format. Each pattern is explained via a diagram, some Java code snippets, its motivation, pros and cons, and a very original 'Often Confused With' paragraph.
Unlike all the other pattern books you've read before, this is not a reference. It's a real programming book that you'll have to read from cover to cover. You'll also need solid programming skills in order to understand the last two chapters (and especially the last one).
- too much code. Probably more than 1/3 of the pages are just printed code.
- typos. There is a slightly disturbing amount of typos in the book, even in some code snippets [like for instance 'Sting' instead of 'String'].
However, these problems should not scare away any potential readers. Because of its original pragmatic approach, 'Holub on Patterns' is surely in the Top 10 Java books for 2005.
Until I read this book I thought I knew OO and was convinced that I was practicing it for the last couple of years, turns out I was deeply mistaken and this book taught me just how little I know.
Two involved examples are given; my initial reaction to the UML and pattern diagrams given was that of confusion. But as Allen walked me through, the confusion faded and I was struck by the depth of their meaning, from then on I use UML a lot more extensively.
At the end of the book there is a short reference to all of the patterns, this 50 page reference is worth the price of the book just by itself.
Awesome stuff, this book is a must read for anybody looking to take the plunge into OO, it has definitely made me a much better programmer. I have read it twice and intend to read it a few more times in the future.
Most Recent Customer Reviews
This book has a lot of very good material.Read more