Book Review: Pro JavaScript Design Patterns by Harmes and Diaz
January 28, 2008
I recently completed a relatively quick read through Pro JavaScript Design Patterns by Ross Harmes and Dustin Diaz (ISDN-13 978-1590599082). It’s definitely one of those books that I’m happy to have read through; I’m always amazed by the flexibility of JavaScript as a language, and believe anyone not familiar with the intricacies of object-oriented JavaScript should pick this up. It also doesn’t dive into any AJAX or domain-specific coverage, making this feel a little less like a Web 2.0 book.
For everyone who appreciates the classic Gang of Four book, you’ll find helpful and interesting implementations of the basics, such as Observer, Adapter, and even Flyweight, in this book; a way to mimic interfaces for JavaScript, and the best rundown of encapsulation, inheritance, and OOP JS that I’ve seen in a book recently.
The application of the GOF patterns to JS is a sticky subject for many; with the speed that web sites and their software platform are revised, a more dynamic language like JS provides a chance to escape patterns for some. This book won't help you solve that question, but it'll give you good implementations and serve as ideal JavaScript code for anyone looking to spruce up their skills. Unlike a strongly typed language, part of the patterns implementation is going to be you communicating with your peers on how to actually go about consuming and publishing JS components in your product.
This also covers a lot of topics that aren’t stressed to JavaScript and AJAX developers on day one: methods being first class citizens, the importance of closures, and just how amazing JavaScript can be. I’d have to say that Chapter One, titled “Expressive JavaScript,” but each pattern-oriented chapter does a great job of covering the reasons for its need, multiple implementations, and an honest pro/con comparison.
Sour (stingy me?) point: as this was on my personal weekend reading list, value comes to mind: As with many of the shorter niche tech books these days, I find myself put off some by the $44.99 list price for just under 260 pages of content. By comparison, the very concise and in-depth Pro C# 2008 and the .NET #.5 Platform by Andrew Troelsen lists at a fair $59.99 for 1,370 pages of awesome content. Granted, both books can be had for less from any book discounter, and Apress offers an eBook format for $23.
Some of the books' content from the publisher:
- Table of Contents [Apress.com]
- Chapter 1 - Expressive JavaScript [Apress.com]