Christian Heilmann

⚡️Review: The Book of JavaScript, 2nd Edition: A Practical Guide to Interactive Web Pages

Wednesday, February 14th, 2007 at 11:43 am

I was sent a copy of Thau’s new book “The Book of JavaScript, 2nd Edition: A Practical Guide to Interactive Web Pages” to review and I wrecked my brain for several weeks as to what to write about it. I showed the book to other colleagues and bloggers who’ve been approached by the publisher to write about it and we all faced the same issues reviewing it. We all were happy about the opportunity, but didn’t want to write a really bad review as there is not much to gain in negativity.

In essence – the book is a wasted opportunity of a re-write and brushing up of a once good book.

I got inspiration as to how to tackle this review when I watched an episode of Scrubs, which featured an older doctor that everybody in the hospital loved and saw as a mentor. This doctor asked a new intern to perform an outdated and possibly dangerous technique on a patient. As the person almost died, people started to realise that the doctor they all admire hides his lack of improvement and ability to learn new techniques behind a very likeable façade. In the end, they had to let him go as this made him a danger for the patients.

This book is exactly the same as this doctor. Thau wow-ed thousands of people with his JavaScript tutorials on webmonkey.com in the past and he has a splendid way of writing and making the readers engage with the book. As a reader of his work it is easy to feel good about quickly learning something you thought you’d never understand. The feel good factor of this book is amazing and the comments on amazon prove that.
In the first edition of this book released long ago this was a great asset to make people go out there and write their first JavaScripts in a matter of minutes. It comes with a price though: the lack of warnings about possible dangers or failures of the techniques mentioned in the book makes it very easy to write unsafe scripts that are a nightmare to maintain.

If you buy a JavaScript book now you expect state-of-the-art information as JavaScript is hot and we learnt a lot from our past mistakes. An equivalent in the non-computer world would be that if you were to buy a book on car technology you’d expect some information on hybrids and eco-friendly cars as much as all about the combustion engine.
This book is like a detailed explanation of how to fix 1940s tractors.

In recent years JavaScript has undergone a massive change: as browsers support the standards set by the W3C like DOM and CSS at least to a stable degree we are able to use these techniques to write scripts that are agnostic of what browser they are executed in. Instead of relying on a browser we simply test for the objects we want to use and only use them after our scripts were successful in detecting them. We also don’t rely on JavaScript but enhance functionality that works without it to make the experience for the end user smoother. These concepts are called progressive enhancement and unobtrusive JavaScript and are never once mentioned in the book, which is a shame as they ensure that when new browsers come out you don’t have to re-visit your scripts and fix them.

The book is very much geared towards browsers and advertises browser sniffing as a valid way of finding out if your script will be OK to execute. It also happily mixes HTML, JavaScript and CSS in one document without separation – something that Zeldman taught us as early as 1998 not to be a clever way of development.
I cannot believe that Thau himself lacks that much insight into how things moved forward in the JavaScript world. My guess is that the book was not re-edited technically (except for a new screenshots) but only extended with a new chapter on Ajax. The mention of http://www.dhtmldrive.com/ which is “coming soon” and http://www.dhtmlcentral.com/ which hasn’t been upgraded since 2002 as great DHTML resources shows that there was not much research happening.

The book smacks of a re-write that went terribly wrong. It is like a “best of” CD of an artist that didn’t want to release a new album but was bound by contract to do so. To make the collection more interesting the label put a “previously unreleased” or “rare live” track at the end and voila – new album!

The new Ajax chapter is OK in explaining the basics of Ajax and features exciting examples but also lacks proper technical editing. For example there is no mention of what to do when the connection doesn’t work properly – using a timeout to tell the user to re-try. There is also no mention as to how to provide links that work without Ajax and override their functionality when JS can be applied. You can build your first Ajax apps with the information provided, but you also create apps that break very easily and are open to attacks. The PHP examples provided don’t check any form data for injected scripts or third party URLs and the book never mentions that this could be a problem.

Overall I am terribly disappointed by this rewrite. The cool title, the oldschool aura about Thau and his engaging way of writing could have been a recipe for a really good JavaScript book for beginners and hobby users. The outdated examples and advertising of unstable techniques as feasible solutions mean that you might as well buy the first edition second hand and go and read an online tutorial on Ajax.

Both Jeffrey Zeldman’s Designing with Web Standards and Steve Krug’s Don’t make me think had a second edition re-write last year and prove that you can build up on an old great book and make it even better and thus worth while spending money on although you have it already on your bookshelf.

I am sorry that I cannot say anything nicer, but that is how it is. I am not a big fan of saying bad things about people or products. If I rip on you personally in public then it is a sign of affection – or that I am terribly drunk – actually most of the time both.

Share on Twitter