XMLHttpRequest, savior of the Internets

For the last few weeks, I've been plugging away nonstop at work on an internal website that will be used to manage a heavily data-driven external customer website. The primary users of this internal site are not at all technically savvy—at least, not outside their specific spheres of expertise—so my primary goal was to make the site highly intuitive, mainly so as to avoid being pestered with questions.

One thing I learned a long time ago is that most people do not find web-based forms intuitive at all. Sure, anyone can use Google, but as soon as you mix it up a bit with a few text input fields, a select box, maybe a checkbox or two, people start getting confused. Adding inline help text and tooltips doesn't solve anything, because people automatically tune them out. They'll always, always assume it's easier to ask someone for help than to look around for an answer themselves, even when it's right in front of them.

So I decided early on that this site, despite being incredibly input-centric and thus necessitating the use of forms, would use them completely transparently. I wanted the users to forget they were using a website. I didn't want them to feel restricted; I wanted them to be able to do whatever felt natural. If a user is looking at a table of customer information and decides they want to change a customer's name, they shouldn't have to click a link and open a form. They should be able to click on the name and start editing, and their changes should take effect transparently. No visible forms, no submit buttons, no page refreshes.

Since I had free reign to do whatever I wanted, and since I didn't have a looming deadline, I decided to take my time, do some research, and try some new things. The first thing I experimented with, of course, was the XMLHttpRequest object, which has been around for a while but has only recently gotten a lot of attention thanks to Gmail. I was not disappointed; XMLHttpRequest is an incredibly useful tool when used appropriately, and it's supported by Mozilla, Safari and Internet Explorer. Opera has lagged behind, but I hear it's in the latest beta (no doubt thanks to Gmail).

I found myself writing a lot of JavaScript and, what's more, I found myself enjoying it. JavaScript is an incredibly flexible language, and while browser differences are occasionally a pain to deal with, they've presented a lot less trouble than I thought they would. I've been developing for Firefox and Internet Explorer. Firefox, of course, has been an absolute dream to work with. Internet Explorer has been less pleasant, but still not as bad as it's made out to be. I'm far more frustrated by the incompleteness of IE's CSS support than I am by the quirks in its JavaScript implementation.

XMLHttpRequest is making things seamless on the back end, between the browser and the server, with data being transferred in the form of serialized JavaScript objects, and the DOM is making things transparent on the front end, between the user and the screen. Tables are populated with data (and sometimes created from nothingness) on the fly, rows are instantly sorted when the user clicks a column header, changes are validated and saved instantly, error messages are displayed inline and attached to the appropriate interface object, etc.

Currently, almost all the client-side work is being done in two JavaScript classes: DynamicForm (for creating transparent forms with seamless validation and persistence) and PagedTable (for creating a data-driven table with sorting, filtering and next/previous-style paging). The site is barely even halfway finished, but I'm already dreaming up ways to use these techniques in other projects (Poseidon, specifically).

A year ago, I would have scoffed at the idea of writing a web application that actually required a user's browser to support JavaScript. Now I'm starting to find it hard to believe that anyone would ever write a web application that didn't. For years web developers have suffered from trying to cope with misbehaving browsers, a lack of standards, and the necessity to support users of old software. Finally, finally, I think the tide has turned. Firefox is rapidly gaining popularity, Internet Explorer, for all its faults, is not impossible to deal with, and Opera and Safari are doing an excellent job filling in the gaps; we've got more standards than we know what to do with; and the popularity of Gmail has paved the way for other highly dynamic websites.

People are starting to expect more, and they're finally willing to upgrade their damn browsers to get it. Thank God.