found drama

get oblique

review: JavaScript Patterns

by Rob Friesel

★★★★☆ on both the Goodreads and Amazon scales.

If you’re a JavaScript developer, you would be wise to have JavaScript Patterns on your bookshelf–nestled nicely between JavaScript: The Good Parts1 and High Performance JavaScript (Build Faster Web Application Interfaces)2. The three make a nice little troika.

And read them in that order: The Good Parts, Patterns, and then High Performance.

Here’s why:

What Stefanov gives us with this book is effectively an overview3 of best practices for JavaScript development, going over the benefits and gotchas of certain important language features, and translating those into design and implementation patterns. Many of these patterns are language-agnostic–and you’re likely to recognize them from “The Gang of Four”–but Stefanov puts them in their JavaScript party dresses and takes them out to the ball. Wisely, Stefanov also presents these patterns in an environment/host-independent fashion, so the lessons you learn about encapsulation or inheritance or performance should be equally valid regardless of whether you’re coding for the browser4 or NodeJS or some image exporting automation for Adobe Illustrator. Stefanov is also a lucid and concise author, clearly illustrating his points about these design patterns; the text is accessible–easy to follow and digest–and he is careful to clearly define words and terms that might be ambiguous or commonly misunderstood5.

JavaScript patterns makes a great transition guide for intermediate developers–the men and women who have stopped confusing jQuery-the-library with JavaScript-the-language–the folks who are ready to re-evaluate their approach software development with JavaScript. This is for the folks that made it through Crockford’s The Good Parts knowing that they learned something but also feeling less-than-certain about how to apply that something. This is the follow-on; JavaScript Patterns is the application of those lessons. And then after you’ve written your clean, maintainable, scalable applications–then you make the jump to Zakas’ High Performance JavaScript to tune things just a little bit further.

So you’re probably wondering then: if you recommend it so highly, why only four stars?

The four stars comes mostly from two niggling points:

  1. Relative to The Good Parts and High Performance, JavaScript Patterns was not published in the order that I recommend reading them. As a consequence, since I’d read the others (and quite a few others above and beyond those two), there is quite a bit of information in there that I’d seen before. This is not a Bad Thing; sometimes it pays to see information presented again–to help it sink in or else to gain another perspective on it. And in some cases Stefanov offers an as-good-or-better explanation on certain topics/techniques as others writing in the field6. Sometimes (and I’ve written this before) you were just hoping for… just a little bit more.
  2. And this is super nit-picky but… The book could have taken another quick editorial pass for spelling and grammar. The one that stuck out at me was right in the intro to Chapter 6 [Ed., emphasis added]:

    But it’s important to keep the end goal in mind–we want to reuse cod;.

    Indeed.

  1. Reviewed on Goodreads, here. []
  2. Previously reviewed here. []
  3. An in-depth overview, but an overview nonetheless. []
  4. Stefanov is careful to “keep the browser out of it” and dedicates only one chapter (Chapter 8: DOM and Browser Patterns) to the subject; though everyone’s favorite host environment does creep in a couple of times, in a couple of examples. []
  5. E.g., “function expression” vs. “function declaration” vs. “function literal”. []
  6. E.g., his examples for memoization and currying rival Crockford’s, and his explanation of the pub/sub pattern (and custom event design) is more concise than the one Zakas presents in Professional JavaScript for Web Developers (previously reviewed here). []

About Rob Friesel

Software engineer by day, science fiction writer by night. Author of The PhantomJS Cookbook and a short story in Please Do Not Remove. View all posts by Rob Friesel →

One Response to review: JavaScript Patterns

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*