VoIP News OnSIP News Developer News

Javascript: The Good Parts

by Erick Johnson

An OnSIP engineer reviews the book, 'Javascript: The Good Parts'

Published: June 25, 2008

javascript the good parts Douglas Crockford1 of Yahoo! has just published an excellent new book titled Javascript: The Good Parts.

Another Book On Javascript?!

The nice thing about this book is that it is not just another manual on ECMAScript, but rather a terse description of JavaScript that "scrapes away the most horrendous features to reveal a subset of JavaScript that's more reliable, readable, and maintainable". The book covers more than the obvious topics like syntax and "global variables are evil" (though that is mentioned ad nauseam) - so you can be assured that this one isn't just a kiddy read. Crockford's major theme of the book (and an excellent one IMHO) is that behind all the crust, fluff, and awkward features of JavaScript there is an elegant subset of truly excellent features in the language. The point being that by strictly adhering to only this subset we can make usable, extensible, manageable software that will have much greater durability than software produced using the ugly parts. I felt Crockford did a very nice job at hammering his points home about his take on the bad parts without sounding preachy in regards to coding style. Only in one of the appendices does he go into detail regarding his preferred style of coding, and even expressing these opinions he does so with sound arguments.

Who's it for?

If terms like "inheritance" and "closure" invoke images of coming to grips with your wealthy aunt Sally's passing, then this probably isn't the book for you. The book's value lies with the seasoned programmer that is experienced mainly in classical OOP or procedural programming. That programmer is the one who will find this book useful in coming to grips with the paradigm shift necessary to work with JavaScript rather than struggle with it. If you're one who finds yourself using JavaScript libraries like jQuery and Prototype but are confused as to what Object.extend and jQuery.extend are actually doing behind the scenes then you'll definitely want to purchase a copy. Plus, unlike those 1100 useless pages of Sams: Teach Yourself J2EE in 21 Days that have been sitting on my bookshelf since mid 20032, this book is sure to be one that you'll actually read. At a mere 100 pages or so (plus 40 pages of appendices), the book is quickly digestible and even more importantly, it's immediately applicable. You will notice your code improving in front of your eyes from the moment you get through the chapters on object literal notation and functions - chapters 3 & 4 respectively. Even if you are one who already know the basics of the language, simple things about JSON, and function scope - then you will still most certainly find use in the Crockford's demystifying coverage of a few of JavaScripts most popular object inheritance patterns. So if, like my former self, you use JavaScript on a regular basis without a strong notion of how to do it "the JavaScript way", then I highly suggest giving this book a quick read. I promise that it will be time well spent.

  1. For those who don't know who Doug Crockford is, he's the guy who wrote JSLint, along with many other invaluable JS tools
  2. I should probably consider myself lucky that I never found those 21 days to give to J2EE