Book review – Object-Oriented JavaScript (Second Edition) by Stoyan Stefanov, Kumar Chetan Sharma

This is a review of the book Object-Oriented JavaScript (Second Edition) by Stoyan Stefanov, Kumar Chetan Sharma published by Packt.

Few words why I read this book – I’m an experienced javascript developer, and I had a chance to work on large scale projects. However, Javascript is there from the early days of the web, when I was learning by trial/error and experiencing, then taking what seemed to work well at that time. Now with rising popularity of javascript (Client applications become richer and server side javascript (Node.js) is mainstream, not mentioning that it’s real cross platform so javascript is everywhere! So yes, if you are new to javascript – it is a smart investment of your time to learn it) I decided to go back and read a beginners book to refresh the basics and improve my proficiency. Of course that I had to skim quickly through large parts of this book.

The book starts from zero and doesn’t assume any programming knowledge or skills. It start from the very basics of variables, conditions, and loops. Therefore parts of it might be boring for somebody who know a thing or two about programming. For beginner level developers this book will definitely be very informative and useful.

The chapters in the book – Object-oriented JavaScript, ‘Primitive Data Types, Arrays, Loops, and Conditions’, Functions, Objects, Prototype, Inheritance,The Browser Environment, Coding and Design Patterns.

I won’t talk about all of them, but I’d like to mention some-
Inheritance – In this chapter the author is showing 12 methods of implementing inheritance in javascript. Although it’s very informative in my opinion it’s too much to show so many methods and discuss performance advantages of some methods over others. The author give few references to Douglas Crockford who is a known Javascript guru and I think it’s very good that the author references Crockford, but some of these methods are outdated. Crockford himself wrote in his website : “I have been writing JavaScript for 8 years now, and I have never once found need to use an uber function. The super idea is fairly important in the classical pattern, but it appears to be unnecessary in the prototypal and functional patterns. I now see my early attempts to support the classical model in JavaScript as a mistake.
http://www.crockford.com/javascript/inheritance.html

The Browser Environment – I liked the separation between javascript as a language and the runtime (browser). What I liked less is that this chapter contains many utility code samples (as well as inheritance chapter). While I believe this is a good approach to show author’s point, it feels like the author expect the developer to take these utility code samples to his software project. I believe that after showing the principles he want to point out, he should have direct the readers to libraries (preferably open-source) that performs these utility functions. Sadly the only library was introduced in the book was commonnjs, I think more libraries should’ve been mentioned through the book.

Overall I would recommend this book for beginner developers. It suggests many best practices and shows some javascript gotchas and pitfalls. I also liked the structure of the book, and the explanations are short and clear with many code samples. It gives a good overview of Object Oriented Javascript.

However, I would expect to have some more advanced topics like real life projects/samples, files structure of a javascript project, testing, and open-source javascript libraries. In addition, a source code with the code samples from the book would be appreciated.

Leave a Reply