Object-Oriented Javascript by Stoyan Stefanov: a book review

Friday Aug 22 2008

My friend and collegue recently asked me if I wanted to write a review of his new book on Object-Oriented Javascript. Of course I agreed and took some time to read the book and form an honest opinion about it. What follows is a review of this new recently released book.

Object-Oriented Javascript is a pure javascript book. It's quite a bit different from many books I've seen before and in this case this is a good thing.

First chapters

In the first two chapters Stoyan provides a quick crash course on the history of Javascript, some fundamentals of OOP (Object-Oriented Programming) and language fundamentals. The first difference with a lot of other books shows fairly early in the book. Stoyan invites his readers to use the FireBug console and immediately try out the examples given in the book to experience them first-handed. The examples are never long winded or complicated but come straight to the point. A great way to achieve an instant learning effect!

Dark Matter Pro: a premium photoblog template.

Affiliate program available

Functions

The third chapter deals with functions. The author will take you knee deep into all aspects of Javascript functions, not avoiding the tricky parts such as self-invoking function, inner functions and closure. Stoyan succesfully manages to explain the fairly difficult to grasp concept of closure in a clear, easy to understand way. A remarkable accomplishment!

Objects

Chapter four deals with Javascript objects. Since everything in Javascript is an object there's quite a lot to tell about this subject. Like in all chapters of the book, everything is explained by using very small and simple examples which can be typed directly into FireBug.

Prototype

Prototype is yet another concept which can be hard to grasp for newer Javascript programmers. This definitely includes people who come from a classic OOP background. I suppose there's a risk of this review becoming a bit boring but again, Stoyan hits the spot with his examples and crystal clear explanation.

Inheritance

The chapter about Inheritance is probably the most impressive part of this book. Stoyan manages to clearly demonstrate no less than twelve different ways to approach inheritance in Javascript and finally presents these in a compact easy to understand overview. The chapter concludes with a case study example which is unlike most of the other examples a bit more lenghty but still small enough to not be intimidating to any reader. Even seasoned Javascript programmers may still learn some interesting bits from this chapter.

Browser Environment

In the seventh chapter, Stoyan discusses the browser environment, working with the DOM and a bit of AJAX. As we all know, whole books that are significantly heftier than this book have been written on this subject so don't expect to become a DOM guru after reading this chapter. Still however it provides a nice overview of both the browser environment and common DOM methods. As this chapter only briefly touches most of the subject matter, a lot of readers could probably do with another book specifically about DOM scripting and AJAX. Christian Heilmann has a great title on this subject.

Coding and Design Patterns

The last chapter of the book is an excellent primer on best practice coding patterns and some common Javascript design patterns. It talks about subjects like separating behavior from content and presentation, namespacing, use of configuration objects, chaining and use of JSON. Finally some popular patterns such as the Singleton, Factory and Observer are discussed and examples are given on how to implement these patterns in Javascript.

The verdict

First things first, Object-Oriented Javascript is a really good book with a refreshing approach on learning a language. What it does NOT provide is fancy code snippets that are ready to (ab)use in any website. This is a real book about programming and not about impressing your friends with some fancy website features. The book is completely neutral on javascript frameworks which is a popular topic in fanboy battles. In some cases it briefly mentions frameworks but only to demonstrate that certain practices are used in them. Therefore, another thing you won't learn from this book is how to do crazy stuff in JQuery, YUI or another popular framework you may like.

This book is about javascript and javascript only. For anyone who is serious about his/her javascript skills I feel this book is a must read. This book is truly one of a kind. Even the more experienced developer will find quite a few interesting techniques in this book which makes it suitable for both intermediate and more experienced programmers. I'm not sure how well this book is suitable for total newbies but if you're smart this book will give you a truly 'head first' introduction to javascript. Object-Oriented Javascript will make almost anyone a better javascript developer. And let's face it, a book that's able to explain closures in a way that most readers will actually understand what it means without being horribly confused is an instant winner!

A highly recommended read!

Tags: ,

bookmarking

Commentary

Join the discussion! Leave a comment through the comment form below!

Got something to add to this?

Feel free to leave a comment on this site. You can use Textile and Emoticons. Your email address is only used to show a gravatar. Please stay on-topic and use common decency. Spammers will be shot in front of a live studio audience.

If you plan on posting code, use pastebin please and post a URL to the code. The comment processing doesn't deal very well with code. Sorry for the inconvenience.

Human comment spammers: don't bother posting your crap here. Comments are moderated and I won't let any of your shit through.

Remember personal info?
Yes
No

Trackbacks

If you have an interesting related post on your own site you can leave a trackback. As they say: 'a little AJAX a day keeps the spammers away' which is why you'll have to click below to generate a trackback key. The key will be valid for 15 minutes and can be used only once.

 

  • Featured Links
RockySomewhere near the Orion NebulaBookalicio.usGolden Gate BridgeThames River BankJackie and mePimpin' it