Relevance Review #7: Professional Ajax

Professional Ajax, by Nicholas C. Zakas, Jeremy McPeak, Joe Fawcett

Quick Summary:Emphasis on irrelevant Microsoft technology plus unlucky timing weaken an otherwise solid book.

Pro Ajax starts strong. The first chapter, "What is Ajax?" is a nice conceptual introduction. Chapter Two, "Ajax Basics", rightly treats the "A" in Ajax as the most significant evolutionary step. The authors work from basic HTTP, through frames, iframes, and XMLHttpRequest. Chapter 3, on Ajax Patterns, shows you a variety of ways asynchronous invocation can be used. Taken in isolation, Chapters 1-3 make a nice mini-book on Ajax.

Chapters 4-6 cover XML. These chapters are not nearly as useful as the first three, for two reasons:

  • The coverage is basic, and belongs in an XML book, not an Ajax book.
  • The conceptual clarity of the first three chapters disappears when the authors are talking about XML. Particularly mystifying is the coverage of Representational State Transfer (REST) on pages 163-166. A reader not already familiar with REST might come away thinking "REST is just like plain old HTTP, except you have to manage links with XLink."

It is nice to see a chapter on JSON (Chapter 7). The explanation is clear, and the authors quickly get to an important point: You don't have to eval JSON! You can (and probably should) use Doug Crockford's library to avoid evaluating arbitrary code in the browser.

Chapter 8 teaches how to create widgets. This chapter is worth reading, because it takes four examples from concept to working widget, including HTML, CSS, client-side, and server-side code. Most Ajax programmers will be widget consumers, but if you plan to be a widget author, or just want to understand how the pieces fit together, you will appreciated this chapter. Chapter 9 builds a more complete example (AjaxMail) and is also worth reading.

As you can probably tell from the individual chapters above, I wanted to like this book. And I do like the Ajax parts (about half the book IMO). The problem is the authors' approach to the server side. Ajax is a client side technology, but to use Ajax you need a server to talk to. This poses a problem for authors, who have to make a choice:

  1. Don't talk about the server side, and let readers make their own choices
  2. Pick a single server side technology and stick to it
  3. Present a variety of server-side options
The authors of Professional Ajax chose to present a variety of options. This approach backfires, as you have to wade through page after page of server-side configuration unrelated to Ajax. Here are some of the topics I found inappropriate in an Ajax book:
  • Configuring Microsoft IIS
  • Installing ASP.NET
  • Creating a .NET Web Service
  • Connecting PHP and MySQL using Microsoft ADO
  • Installing the Java SDK
  • Using Microsoft ODBC to connect to Microsoft Access from Java
There is a bizarre Microsoft bias here. I wouldn't be surprised by a book that said "We're gonna use .NET because it rocks." But what we have here appears to be an honest attempt to use a variety of different technologies, ruined by an unspoken assumption that servers run Windows.

Would the book be better if the authors dropped the non-Microsoft examples, and just came right out and titled it "Professional Ajax for .NET Programmers?" I think so. Unfortunately for the authors, the Microsoft world changed out from under them between writing and publishing. Microsoft's Ajax strategy now appears to be built around Atlas, which does not appear at all in Professional Ajax.

Last Word:Useful for developers building Ajax with yesterday's Microsoft technology. Would be nice to see a new edition of the book that covered Microsoft's Atlas.