Sunday, January 11, 2009

I sometimes teach classes at AcademyX, and by luck the San Francisco campus of AcademyX is located within walking distance of my office on Market St. On my way to class, I often pass a collection of commemorative placards that mark the site of the old western terminus of the Pony Express on Clay St. between Kearny and Montgomery. Many people have heard of the Pony Express: a heroic enterprise in which mail pouches where carried over the Rocky Mountain West in a tightly scripted relay of horses and riders. Deliveries could make it from Missouri to California in just 10 days, which a very good time for horse and rider.

One surprising fact about the Pony Express is that it lasted less than a year as a going concern. But Pony Express couriers are still galloping through the American imagination; even today the Pony Express emblem is used by the U.S. Post office.

It was technology that killed the Pony Express: the service was discontinued shortly after completion of the transcontinental telegraph. This is a familiar story to those of us who've been following digital technology for very long. Ingenuity, planning, and perspiration won't make the grade if you're competing against a superior platform. With just a flick of the wrist, a telegraph operator could beat a team of Pony Express riders and their carefully build infrastructure of relay stations. This got me thinking: could it be that Asynchronous JavaScript And XML (a.k.a. AJAX) will face the same fate as the Pony Express?

The role of the transcontinental telegraph in this story will be played by Rich Internet Applications (RIAs). RIAs have actually been around since before AJAX, but they have been slow to catch on compared to the wildfire acceptance of AJAX among web developers. But there can be no doubt that RIAs are catching on. Flex has clearly had blockbuster success recently, and both Silverlight and JavaFX are waiting in the wings.

Now that AJAX interfaces are common on the web, the limitations of this architecture are becoming clear. It's common for AJAX pages to become unresponsive when something goes wrong with a script based postback. Error handling is a problem; most browsers have JavaScript error reporting turned off by default because errors are so frequent. Last year I was blown away and frankly shocked by Alan Holub's presentation about the security problems associated with AJAX. Most importantly, from a developer's perspective, AJAX can be a lot of work. Of course there are frameworks that make simple and common effects easy to achieve. But frameworks require debugging and customization: ultimately there's no escape from the complexity of the architecture.

Ultimately the advantage of an RIA platform is simplicity. An RIA application is what it is: a stateful, sandboxed, and media rich application that can be scripted to respond to user interaction. In fact, we can drop the "scripting", RIAs run compiled code, just like a decent programming environment. An AJAX web application only appears to be these things. There is no simplicity, even in the simplest AJAX enabled page.

As a programmer, what would you rather do: spend a few hours in a single development environment putting together an application with data binding, full user interaction, and some neat animations, or spend several days making an AJAX-enabled web page behave as if it were an RIA? If you chose the AJAX path, you might just be as heroic as the Pony Express rider of old, doing the impossible with stout ponies, wits, and willpower. No doubt you'll have some adventures along the way. When you get to town, you'll find me a the telegraph office.