Review of "Object-Oriented JavaScript"
Table of Contents
I recently read Object-Oriented JavaScript, by Stoyan Stefanov. In reviewing it, I found it was one of the most interesting books Iâve read in a while, for some good reasons and a few more curious reasons.
Object-Oriented JavaScript was authored by Mr. Stefanov, who is a developer at Yahoo. It features an impressive number of reviewers (twelve), among them Douglas Crockford, the author of JavaScript: The Good Parts, and Ross Harmes, author of JavaScript Design Patterns, both of whom are Stefanovâs Yahoo co-workers. In a reasonable 330 pages, it features eight chapters on JavaScriptâs History, Basic Syntax/Features, Functions, Objects, Prototypes, Inheritance, the DOM, and Patterns/Best Practices.
Readers with little to no JavaScript knowledge will be able to read this book, but Iâm uncertain how much theyâll be able to glean from the meaty inner chapters (functions, objects, prototypes, and inheritance). Readers with moderate JavaScript understanding should be able to learn a great deal from this book. At the very least, advanced readers should be reminded of some of the languageâs quirkier parts, as well as benefiting from an organized chapter on inheritance techniques.
It is tricky placing Object-Oriented JavaScript in context of the corpus of JavaScript literature. This book includes more than a little introductory material (chapters 1-2), while the core chapters (3-6) are way beyond an introduction. Only after those chapters (which I will discuss in a second) is the reader introduced briefly to the DOM and XHR before a chapter on design patterns and best practices. At a minimum, every chapter is useful and full of hints that are difficult to grep from run-of-the-mill JavaScript books. The book steers clear of the murky world of browser differences unless theyâre pertinent to the topic of Object-Oriented JavaScript, which seems perfectly acceptable.
Back to those middle chapters, they are sheer gold. I am going force myself to make time to re-read this book, if not those chapters alone. They present, in a clear and organized fashion, many difficult aspects of the language, including closures, prototype, and 12 different methods for inheritance. In comparison, I believe Harmesâ book isnât as well organized, and Crockfordâs book isnât as clear. Stefanov doesnât break much new ground here, but the clarity describing these techniques is quite valuable regardless.
Object-Oriented JavaScript appears occasionally try to be something to everyone. This is kind of disappointing, since I would have loved to have seen any additional discussion or insight the author could have offered in the core chapters. There are tons of introductory JavaScript books, so I donât know what a book titled Object-Oriented JavaScript gains by including more introduction. This shouldnât detract from the bookâs overall value. All of the chapters are well written and useful. However as a reader gains a better understanding of JavaScript, the introductory chapters will become far less useful, while the other chapters will remain an excellent reference.
In my mind, the three best JavaScript books are Flanaganâs JavaScript The Definitive Guide, Crockfordâs JavaScript: The Good Parts, and Harmesâ and [Dustin] Diazâs Pro JavaScript Design Patterns. Object-Oriented JavaScript doesnât belong in that company for the reasons mentioned above. However, I would easily give it fourth place, and recommend it as a clear description of JavaScriptâs harder parts.
