Effective JavaScript: 68 Specific Ways to Harness the Power of JavaScript follows the format established by Scott Meyers’s seminal Effective C++ but is arguably even more useful, thanks to the popularity of JavaScript and the many pitfalls and blind corners introduced by its syntactically forgiving, dynamically typed, shake-it-like-a-Polaroid-picture philosophy and coding style. Buy it, read it, forget it, read it again. This book is one for the desert island.

It’s probably fair to say that JavaScript has always had a bit of a problem with code quality. Derrick Pallas, writing for the Daily WTF, circa 2007, is representative of the frustration:

The advent of JavaScript has made it really easy to write web pages that interact with you. Really, it’s insanely easy. The barrier to entry: way too low. It’s not that all JavaScript is bad, just that most JavaScript is not written with simplicity, correctness, consistency, or completeness in mind.

The value of a book like EJ68: it directly and immediately increases code quality by communicating the most important idioms, gotchas, and best practices that have coalesced out of the last 20 years of hard-won industry practice (yup, JavaScript is that old). The recommendations are presented in the imperative tense and, at a few pages each, can be digested anytime you’ve got a half hour to burn:

  • Item 8: Minimize Use of the Global Object
  • Item 13: Use Immediately Invoked Function Expressions to Create Local Scopes
  • Item 30: Understand the Difference between prototype, getPrototypeOf, and __proto__
  • Item 42: Avoid Reckless Monkey-Patching

Code quality was admittedly a toothless concept when the nominal use case for JavaScript was swapping a button image or squirting out a bit of client-side validation. Today, JavaScript applications are larger and more complex than their predecessors by an order of magnitude. Code quality has become not just important, but supremely important, because without it, almost nothing interesting can be built in JavaScript. (Whether project stakeholders are aware that this is the case, is another question.)

Highly recommended for all JavaScript devs, teams, and organizations.

Herman, David (2012-11-26). Effective JavaScript: 68 Specific Ways to Harness the Power of JavaScript (Effective Software Development Series). Pearson Education.


  • Christopher Galpin says:

    CoffeeScript goes to some effort to fix these problems, however it actually seems to go a bit *too* far and have its own set of issues like mentioned here: “CoffeeScript’s Scoping is Madness” https://donatstudios.com/CoffeeScript-Madness

    Overall though I still prefer CoffeeScript having seen see how long and convoluted “correct” JavaScript looks (e.g. what CoffeeScript generates).

  • Leave a Reply