The Ajax Philosophy

 

How the client—in this case, a web browser—communicates with the server is one of the cornerstones of Ajax. Designed with the philosophy of not using bandwidth just because it’s there, a web page coded using these techniques won’t go through the unload/reload cycle, or “blink,” as some refer to it, unless

absolutely necessary. Why send 100,000 bytes back and forth to the server when 300 bytes will suffice? Of course, this means that, to the casual observer, the browser is behaving strangely because sometimes only selected parts of a web page are updated.

 

This means that the page won’t “blink,” as the peasant—er, client—so elegantly

put it. Instead, in a wink of an eye, parts of the page will update quicker than they believed possible. The speed difference can be compared to the difference between accessing a file on a floppy disk and accessing a file on the hard disk. Personally, my reaction was along the lines of “I am never going back!” But individual results can vary, so consult your doctor.

Another concept that Ajax uses is, why not make the client work for a living? Have the client’s web browser handle parts of the processing rather than just parrot preprocessed information on the screen. The initial page load would consist of data and JavaScript, instructions on what to do with the data. To expand upon the earlier mad scientist analogy, imagine a do-it-yourself “mad scientist” kit consisting of a pile of parts and a minion that answers to Igor, and you’ll get the idea. With an Ajax application, the browser is expected to actually process the data supplied by the server. This means not only the little things that DHTML did, such as rollovers and hierarchical drop-down navigation menus, but real

things, such as posting to the server and handling the response, whether it is

handling it either synchronously or asynchronously. In addition, Ajax applications

need to be able to not only find objects on the HTML page but also, if necessary,

update them. This leads to the question of how, short of the whole kites and Igor

methodology, does one accomplish this unholy task? The answer is that it

depends on just how and how far one wants to pursue this course. There are

three ways to bring life to an Ajax application, and each has its own advantages

and disadvantages. It all depends on just which parts of the Ajax toolset

the developers are comfortable with. It also depends on how comfortable you

are with excluding certain members of the planet from the application. Yes,

I’m talking about those people who are still running Internet Explorer version

2.0. Fortunately, it isn’t my job to issue decrees concerning browser compatibility;

however, it is my job to cover how to implement an Ajax application.