Digital Web Magazine

The web professional's online magazine of choice.

Book Review: Bulletproof Ajax

Got something to say?

Share your comments on this topic with other web professionals

In: Reviews > Book Reviews

By Matthew Pennell

Published on April 10, 2007

DOM Scripting author and bon vivant Jeremy Keith returns to the shelves of your local bookshop with his second book, Bulletproof Ajax—and despite its narrow scope, it’s a worthy addition to your collection.

The first thing that you realize is that, at barely two hundred pages, this book is slim. While the techniques may indeed be bulletproof, you could probably tear the book in two with your bare hands. In comparison with other similarly priced volumes, it is tempting to feel a little short-changed, but given the self-imposed limitations of the subject-matter—we are only talking about one specific JavaScript object, after all—the book covers all the relevant information in more than enough depth to ensure that the reader understands the principles under discussion.

Who is the book for?

Although there is a one-chapter crash-course on JavaScript, one would hope that anyone coming to this book as a beginner would have already learned at least a little JavaScript sans AJAX—although it would be difficult to find a modern JavaScript book that doesn’t include its own AJAX chapter—and the book presupposes a decent understanding of HTML and web standards in general. Even if you are already fairly happy with AJAX—perhaps you’re already using it on your own sites—there are lessons to be learned here that are not just limited to the right code to use.

What will I learn?

All of the most common formats of server communication—XML, JSON and HTML—are covered in reasonable depth. But it’s once we get into the nitty-gritty of XMLHttpRequest, the bulletproof-ness starts to make itself felt. While there are probably many novice JavaScript developers out there who consider themselves reasonably competent, just how much do you really know about the different versions of the ActiveX object, or browser quirks that can affect your response status code? Keith explains each hump on the road towards truly reliable, bulletproof scripts in a clear, straightforward way, and the supporting code examples are easy to follow.

The section on data formats has a useful aside on the benefits of third-party APIs offering JSON responses. The chapter on accessibility is disappointingly brief (it’s discouraging to know that all of our current knowledge on AJAX accessibility can fit into a mere ten pages), but it does contain some handy tips on making the most of the tools currently available.

If you have had the good fortune to see Keith speak (and it’s been pretty hard to avoid him on the conference circuit recently) then you will be familiar with his own brand of AJAX implementation, a technique he terms ‘Hijax’. In essence, he advocates building web sites that work perfectly well without AJAX, but that then have a layer of unobtrusive, progressively enhancing JavaScript and AJAX added to improve usability, reduce page requests, and generally make your page or site a little more 2.0. The second half of the book discusses how careful planning of your site architecture can enable this approach, and closes with an example of an online bookstore that is subtly enhanced with AJAX/Hijax.

Summary

It is tempting to claim that the benefit that anyone may get from reading this book is directly proportional to how closely his or her own approach gels with the ‘Hijax’ method Keith focuses on. But, while it may not be what eager young developers want to hear about this hot new technology, at the core of the book lies a mature and responsible attitude towards AJAX and web development as a whole, which goes beyond any one particular technique. Backwards compatibility, thwarted user expectations, and broken browser features such as bookmarking and the Back button can often be annoyances to developers working on AJAX-enabled applications, but it is clear throughout the book that, for Keith, these concerns are at the core of his philosophy when it comes to adding AJAX functionality to any web page.

This book will not give you the skills to build the next desktop-like web application, full of rich, real-time interaction, but it just might make you think twice about how—and indeed when—to use AJAX.

If you’re happy just knowing the specific syntax of jQuery, Prototype, YUI, or your own library of choice, and care little for what is going on under the hood, then it is easy to dismiss this book as an unnecessarily detailed look at one aspect of a language that has already been abstracted to such an extent that you don’t need to know how it works (just that it does). If this is you, though, think again—simply because the inner workings of the XMLHttpRequest object may not interest you, do not pass over the bigger picture presented here—that we, as web designers and developers, have a responsibility to build pages and sites that enable and enrich, not frustrate or disenfranchise, our users.

Got something to say?

Share your comments  with other professionals (2 comments)

Related Topics: Programming, DOM, Scripting, XML

 

Matthew Pennell works as a senior designer for one of Europe's leading hotel booking websites, writing semantic XHTML, bleeding-edge CSS and JavaScript that usually works. He is the former Managing Editor and former Editor in Chief of Digital Web, and blogs at The Watchmaker Project.

Media Temple

via Ad Packs