Good JavaScript Reading, Part 3: Ninjas, Good Parts and Dailies

Shopify

Secrets of the JavaScript Ninja


Secrets of the JavaScript Ninja is an upcoming book from Manning Publications written by John “jQuery” Resig and Bear Bibeault, author of a number of JavaScript-related books including Ajax in Practice, Prototype and Scriptaculous in Action and both editions of jQuery in Action. It’s a MEAP (Manning Early Access Program) book, meaning that it’s a work in progress that you can purchase in advance; you can download drafts as they are submitted and depending on what you ordered, you get either the final ebook or dead-tree edition when it’s done.

The book’s been a work in progress since 2008 and it looks as though Bibeault was added as an author to get the thing done by the August 2011 target release date. There’s no shame in this; Resig’s a busy guy, and while I’d love to see this book finished, given the choice between a finished jQuery book and continued work on jQuery and all the related projects, I’d always rather have the latter. As of this writing, 14 out of the 17 chapters are done and my guess is that the book looks to be on track for an on-time release.

Although currently incomplete, the drafts of the book have served me well over the past three years. The book starts where few do, with a chapter on testing, covering both the general principles of unit testing as well as an overview of some of the more popular test suites. From there, the book covers the functional programming aspects of JavaScript with chapters on functions and closures and then the object-oriented aspects with a chapter on function prototypes. There's a block of chapters that cover misunderstood aspects of JavaScript: timers, regular expressions, the with statement, the eval statement and writing code that works across browsers. And finally, there are the chapters that deal with web pages: CSS selectors, the dreaded DOM, attributes and CSS and event handling. All these chapters are chock-full of good code examples.

My recommendation? Start with Eloquent JavaScript (covered in an earlier article), and then follow it up with Secrets of the JavaScript Ninja.

A little aside: The book uses ninja in the title, but there's a samurai on the cover. What gives?!

JavaScript: The Good Parts (and a bonus history lesson)


Before Douglas Crockford's JavaScript: The Good Parts came out, the JavaScript book landscape was pretty bleak. Many of these books treated JavaScript as Java's poor cousin, but who could blame them? Netscape itself did the same, according to this explanation by JavaScript creator Brendan Eich (written in response to Jamie Zawinski blog post "Every day I learn something new...and stupid", in which he talked about the wacky way all JavaScript numbers are double floats):

JS had to "look like Java" only less so, be Java's dumb kid brother or boy-hostage sidekick. Plus, I had to be done in ten days or something worse than JS would have happened.

In spite of its being hidden under a clunky, inelegant and quickly hacked-together syntax, Crockford saw the powerful object-oriented and functional language beneath and wrote the seminal 2001 piece JavaScript: The World's Most Misunderstood Programming Language and a series of articles that showed the power, capabilities and quirks of what is now called "the most important programming language in the world". He also popularized the JSON data format, freeing many of us from XML Hell.

I consider JavaScript: The Good Parts to be the first of the really good JavaScript books, and its chapters on objects and functions are still required reading. However, with the recent release of Eloquent JavaScript and upcoming release of Secrets of the JavaScript Ninja, it's no longer the first book I'd recommend (it's still one of the better ones, though).

DailyJS


DailyJS is the most regularly updated blog on JavaScript out there. As its name suggests, it's a blog that features a new story about JavaScript or a JavaScript framework or library every day (or almost every day, anyway). There's a lot going on here: a tutorial series called Let's Make a Framework (where you do just that), another series called Code Review in which they examine the code of many popular JavaScript frameworks and libraries to see what makes them tick and see how the established projects are written, and various articles on all things JavaScript. If you're developing in JavaScript, you should bookmark this site.

Next: Introducing CoffeeScript

This article also appears in Global Nerdy.