[It has good parts?]

I recently finished reading Douglas Crockford’s Javascript: The Good Parts from O’Reilly Media. This slender book cannot be considered a complete reference guide to Javascript, nor a primer on programming. The author mostly avoids discussing how the language works in web browsers, the natural habitat of Javascript.

Instead, this book is meant to introduce a subset of the language that the author believes to be the most useful to the reader and the least likely to cause harm. If this seems like presumptuous concept for a book, you’re mostly right. Javascript is best used in small doses only at need. However, as a author of the Javascript Object Notation format, Crockford does have the bona fides to make such recommendations. As it turns out, many of those recommendations are worth following.

The book clocks in at about 145 pages and ten chapters. Seven of those chapters introduce the major components of the language: grammar, objects, functions, inheritance, arrays, regular expressions and methods. As I said, this book is not for novices, but one could (maybe) pick up the language from these chapters. If one is already familiar with the language, Crockford does provide some valuable insights into how the language actually works as opposed to how most of us expect the language to work. Of particular note are the sections on objects, functions and regular expressions.

Chapter 10 is a bit of let down. It’s call “Beautiful Features.” After reading 100 pages of syntax and commentary, I expected to have a rather lenghty exposition of the wonderful things that can be done in the subset of javascript previously described. However, that is not what this two page chapter is about. Instead, this is a sort of conclusion with some hand waving. There is meat in the appendices that follow. Perhaps this chapter was originally all of the appendices concatenated together and the editors split them. That sort of thing does happen.

Throughout the book, Crockford blithely offers such commentary on Javascript like “[That all object properties are public] is a serious design error in the language” or “Because of a design error, arguments is not really an array.” The pedantic voice of the author will grate on some reader’s nerves. The tech world is full of such writers. If this affectation can be ignored, there is useful content here that will demystify javascript’s weird functional, classless object system, it’s prototypical inheritance scheme and it’s somewhat weird function parameter access. But frankly, I was expecting a book a lot more like Pike’s The Practice of Programming but in a javascript context.