Book Review: Foundations of Ajax

Foundations of Ajax

Foundations of Ajax
By Ryan Asleson and Nathaniel T. Schutta
Publisher: Apress
ISBN: 1-59059-582-3
296 pp.

I was going to begin this review with something like “Ajax burst onto the web development scene in recent years...” But the book’s jacket blurb does the job nicely:

“Ajax burst onto the web development scene by offering highly interactive, desktop-like web applications that can be deployed through any modern web browser without the need for special plug-ins . . . Foundations of Ajax explains how to combine these technologies effectively to implement Ajax into your new or existing web applications.”

Ajax itself isn’t a specific language or framework, of course; but it’s a well-documented technique for improving the user experience for web-based applications.

The book starts with the obligatory brief history of browsers and web applications. Then it knuckles down and discusses that “great enabler” of Ajax as we know it, the XMLHttpRequest object. In fact a whole chapter is given over to XMLHttpRequest, meaning that by the time you’ve reached Chapter 3, you should already have an excellent grasp of the mechanics underlying asynchronous, interactive web apps: in particular, where the “asynchronous” part comes from.

The server-side examples are given in Java, so devotees of other religions (Ruby, C#, PHP etc) may feel a little left out at times. However, the authors have done a good job of minimizing the amount of Java-specific code; e.g. illustrating, with a straightforward Java servlet or two, how the server may respond to an Ajax request. And in fact, the majority of examples are client-side, using JavaScript (which makes sense, of course). So you don’t have to be a Java programmer to benefit from this book.

Talking of examples, the book explores some compelling reasons to incorporate Ajax techniques on your next project; e.g. they provide an autocomplete function, modelled on the poster-child Ajax web-app, Google Suggest. Other examples include updating a list-box when you select something from some other list; creating an auto-refreshing page; and displaying a progress bar.

You might wonder why you should buy a book on Ajax development when so much information on the subject is freely available on the web. Of course, this is a question that book publishers are grappling to answer: to provide extra “value-add” in books that you just don’t otherwise get on-line. One of those “value-adds” is probably depth: in the book format, it’s possible to go into a greater level of detail than you’d find in a web article.

For example, in Foundations of Ajax, there’s an excellent chapter on building the ultimate Ajax developer’s toolbox. This chapter covers some areas that tend to be glossed over (or missed out entirely) in web-based tutorials, such as: how to document your JavaScript code; how to validate your HTML content using Firefox extensions; how to perform JavaScript syntax checking with JSLint; and compressing and obfuscating JavaScript code. There’s also a whole chapter given over to testing JavaScript with JSUnit (a test framework modelled closely on JUnit).

One criticism often levelled at Ajax development is that JavaScript is inherently difficult to debug; the main reason being the lack of debugging tools available. However, this situation is rapidly changing; and in Foundations of Ajax, a chapter is given over to exploring JavaScript debugging tools and techniques.

Noticeably, this book deftly avoids dwelling on any particular Ajax web framework, instead focusing on the low-level “nuts and bolts” of development. An increasing number of Ajax web frameworks promise to hide the developer from these low-level details: Google Web Toolkit, Prototype, Microsoft’s Atlas for ASP.NET 2.0 and so on. But even using a high-level framework, it pays to have a solid understanding of what’s really going on. This especially helps when your application goes wrong, and suddenly you’re plunged into the low-level plumbing in order to fix it.

Overall, this book is highly recommended. It's a year old already, but it remains highly relevant, as the underlying details that if focuses on haven't changed. It isn’t a giant doorstop of a book: it’s a mere 260 pages (definitely a good thing!), meaning that it won’t take you long to read and digest. However, it’s written using a crisp, minimal style, meaning that it packs a lot of detail into a small space, without being too terse.

After reading this book, you’ll be well equipped to start confidently building Ajax web applications.

About the Author

Matt Stephens is a senior architect, programmer and project leader based in Central London. He co-wrote Agile Development with ICONIX Process, Extreme Programming Refactored, and Use Case Driven Object Modeling with UML - Theory and Practice.


Upcoming Events


Sign up for our newsletter.

I agree to this site's Privacy Policy.