Justin Gehtland, Ben Galbraith, and Dion Almaer bring us a valuable and enjoyable book describing Ajax. It is full of running examples, points out the major gotchas, and it's a good read too! Recommended!

image

Pragmatic Ajax

Justin Gehtland, Ben Galbraith, Dion Almaer programming

Ajaxian Maps

The book starts off strong. After a brief introduction, the authors take us through an implementation of a mapping application that’s very much like Google Maps, the web app that put “Web 2.0” on the, um, pardon me, map.

I particularly like, in this part, that they show how the tiling geometry works. Folks always think that tiling and graphical ports and windows and such are difficult. Yet, approached cleanly, they are not, and Pragmatic Ajax gives a good example here of how straightforward such things can be.

By page 37, you’ve implemented a sweet little map application, that can be seen here. Neat.

The book moves right along, adding the zoom tool and push pins. They even show you what to do about the inevitable fact that Internet Explorer doesn’t support things like transparency correctly. With all the money in the world, why can’t they fix that stuff? But I digress …

The book shows the code you need, and of course the code is also available on the pragprog website. Delicious. These guys do good work.

Filling a Form

We move from the sublime to the practical, making fields on a form fill in without refreshing the whole page. Again, IE doesn’t correctly support XMLHttpRequest. Maybe next service pack. <sigh/>.

This chapter is putting off telling us how the server processes our calls to it, but takes us through things that I badly need to understand, like the way that state changes come back and get handled in our JavaScript.

But Wait! There's More ...

The book provides a brief but valuable explanation of some of JavaScript’s nicities. It briefly describes the Document Object Model that underlies modern browsers – a short and clear description that I really liked. I don’t like the DOM, mind you, but I do like the writeup.

Then the authors give us a look at some of the frameworks and toolkits that are available for Ajax. They introduce us to some of the UI libraries, and they give us some good simple advice about keeping our new-found power under the user’s control, not just our own.

They tell us about JSON (JavaScript Object Notation) and its RPC counterpart. They tell us about server-side integration using PHP, Rails, Spring, and ASP.NET. Best of all, they port their standard application (a Customer Relationship Manager) to each of those systems.

The book closes with a look at the future of Ajax as these authors see it, describing the <canvas> element, and Scalable Vector Graphics (SVG). They even provide a little page that displays a bar chart using <canvas>, and in SVG. They also point to other interesting canvas-based and SVG-based sites.

Bottom Line

I like this book. I don’t know whether, much less when, I might convert this site to use Ajax. Probably I’ll encounter clients who are using it before I do much more than an experiment here at home.

Justin Gehtland, Ben Galbraith, and Dion Almaer have done a very good job with this book. It’s well written, interesting, and best of all it includes some simple but powerful examples that can get you over that hurdle of putting up your first Ajax pages. Like all the PragProg books, it is attractive to read and well laid out.

If I had written this book, I’d be quite proud of it, and Justin, Ben, and Dion should be. Well done!