Pro JavaScript Design Patterns
by Ross Harmes, Dustin Diaz
ISBN 159059908X
Date Read 6/2009
My Rating
After reading a few books on JavaScript, I wondered… I wish there was a JavaScript book on Design Patterns. I was very glad when I found this book! It’s an advanced book loaded with great content, interesting style, and practical examples.
2 in 1. Not only do you get a refresher on Design Patterns, but you get to see some advanced JavaScript. It’s a really good combination.
Design Patterns/Javascript combination. This is a design patterns/JavaScript book. That said, you will not really learn JavaScript from it. Similarly, if you want to learn Design Patterns, you are better off going somewhere else. But if you combine these two, and don’t really focus on either one, you get a nice result. That’s exactly what this book is all about: how to implement some GoF patterns in JavaScript.
Design patterns. Which ones? Not all of them, but majority. Looking at the TOC, 12 GoF patterns are covered (Singleton, Factory, Bridge, Composite, Facade, Adapter, Decorator, Flyweight, Proxy, Observer, Command, and Chain of Responsibility). Plus the authors included chapters on Interfaces, Encapsulation, Information Hiding, Inheritance, and Chaining.
Best practices. The authors focus on creating best-practices solutions. I love that. I also love the authors style of code. You get to learn several different styles of creating JavaScript objects. (Could use a bit more explanation about them, but this is not an intro book.) I like to learn from examples, and there are plenty in this book.
Heavy on code examples. Light on explanation. I said it before, the way this book is written makes it suitable for you only if you have a good grasp of JavaScript and GoF Design Patterns. But still, I found this book hard to understand at times. I lost focus a few times. I think the authors could have done a much better job in this regard. The authors briefly explain the pattern and then they give you a long example. A short explanation follows. Very brief. If you don’t understand the full example, you’re out of luck. I would like to see short snippets extracted from the full example and explained. Repeated. So you learn better. And clearer that way.
Plan to re-read. You are most likely not going to “get” this book on your first read. I plan to re-read it. I will take it as an opportunity to deepen my GoF design patterns knowledge. Sort of read two books at once. Sounds like a plan.
I really liked this book. Design patterns knowledge is very relevant. JavaScript is gaining popularity and getting more advanced. It’s becoming a real programming language. I am still surprised how far it has come. This book is a really good gift to both communities. I highly recommend this book. It’s just the the book I was looking for!