Ajax as optimisation

It seems to run in cycles - the Ajax backlash - where seasoned developers can no longer bite their tongue on the Ajax issue. Alex Boswell lead the charge with Ajax Mistakes and followed a year later with the more meditative Rocky Shoals of Ajax Development

I think most tech blogs I read have gone there however most recently I caught Neil Mix’s Ajax as an Anti-Usability Pattern

I don’t want to cover old ground, anyone who sees Ajax as more than just another tool in their toolkit is kidding themselves, but I do think its worthwhile discussing what Ajax can actually be used for. Neil is right, it certainly doesn’t make things inherently more usable - in fact there are so many destructive elements of Ajax that have to be accounted for that to use it without the support of one of the major libraries can be a usability don’t or at very least a time-sink.

Ajax is only a usability enhancement insofar as any performance optimisation that improves perceived loading time is a usability enhancement.

I think that the most useful way to think of Ajax is as an optimisation. This will change your approach to web development in a number of ways however take these two tips and see how you go:

  • Build an application which can have Ajax layered on unobtrusively. There are plenty of articles on this topic so I won’t expand on this further, but suffice to say it leaves the door open for Ajax and you can stop thinking about it and get down to building your application.
  • When you have a functional version of your application and you are evaluating its performance both from the standpoint of raw metrics (total query time, total page load etc.) and percieved page load (ie. does the page or application just feel slow?); consider Ajax alongside all your other optimisation techniques.

My guess is that most times you are likely to opt for solutions other than Ajax. When confronted with a page with a number of distinct elements on it, you may elect to load each individually with Ajax if this decision-making is done at the head of a project. The danger is the buzz behind this technique has pushed it out of sequence, to the front of the decision making process. Ajax is not being evaluated alongside much longer established optimisation techniques because Ajax is being mistaken for an essential usability enhancement.

I find that when you put Ajax and server-side caching head-to-head in your first round of optimisations then you will get more bang-for-buck from the caching. This is because many web-applications are victim to the number of individual requests that make up a page - a problem that Ajax only exacerbates.

Once you’ve got your caching, your query optimisation, your initial client/stakeholder feedback you are now free to consider any further optimisation strategies which will potentially provide a more satisfying user experience. Who knows, you may even use Ajax!

Stumble it!

One Response to “Ajax as optimisation”

  1. wioota.com » Blog Archive » Javascript: The Quickening Says:

    […] There have been philanthropists in javascript development since the language was concieved by Brendan Eich. A few that I can point to as having provided tools and inspiration along my path in web development: Mike Foster and his excellent x library (and it predecessor) which just worked and added some bling to projects of a few years ago; Brent Ashley and the jsrs library code and examples which opened my eyes to a new form of optimisation I could use in the web applications I built; PPK for the never-ending resource that is quirksmode… I am sure you all could name others that facilitated your own web application careers - feel free to add to this article in the comments. […]