February 23, 2006

...Learn TDD with Codemanship

AJAX - Don't Mention The Elephant !

AJAX - or to give it it's full name, Asynchronous JavaScript & XML - is being touted as the "megatrend de jour" for web developers this year. The basic idea has been around for a few years. In the old, nasty web ("Web 1.0", we are led to believe), users clicked a button on a web page and then waited several seconds/minutes/hours/eons for a request to be sent to a server somewhere on the other side of the country/world/galaxy/multiverse, and then waited yet more seconds/minutes/hours/eons for the remote server to generate a response and send it back to your web browser. Even for the smallest actions, like updating a menu list, it took ages for the page to refresh so the user could continue.

I think that's what they used to call the "World Wide Wait"...

Anyhoo, along comes what Microsoft used to refer to as remote scripting. (Ohh. Aaah). The basic idea was that the page wouldn't refresh with a whole new page that had to be regenerated and resent back to browser in its totality. Instead, a little snippet of JavaScript (or VBScript, back in the days when Microsoft still seriously believed we'd use it for client-side scripting) would "go get the data" and update the page while the user could carry on doing whatever he or she was doing. By making the requests asynchronous, and by dramatically reducing the amount of data going back and forth - this was just for the data that was needed, not a refresh of the whole web page - web applications could be made to feel more responsive. With a lot of luck and a good wind behind you, you could even build DHTML applications that worked a bit like rich client applications. Woohoo!

And then the dream died. Largely because it turned out to be a stupid and pointless waste of everybody's time:

1. Writing browser scripts is laborious and error prone, and only idiots - and people who aspire to be idiots - choose to use JavaScript when they have perfectly good languages like Java and C# readily to hand
2. It was never really that big of a problem

But, whaddayaknow - remote scripting is back. Only now they've changed it's name, made it non-Microsoft-specific (which always helps) and it's a cornerstone of what they would have us believe is "Web 2.0"

So I see web sites galore saying "AJAX is great", "I love AJAX", "AJAX is the second coming", and so on. Well here's a big heads-up, folks: AJAX sucks. It has one monumental flaw that means that any IT manager gullible enough to invest in AJAX development will regret it for years to come.

JavaScript is very difficult and costly to maintain

If you're going to go down the AJAX route you may as well build the thing in BASIC and store it on C60 cassette tapes. The effect will be about the same. In the longer term, you will have a huge legacy headache, and to tout this is as a "good thing" is to miss the point of software deveopment completely.

Anyone who sets out from the start to create unmaintainable legacy code shouldn't be allowed near an IT project. But so they do, and the whole industry seems to be alive with the AJAX buzz. I thought it was time somebody mentioned the elephant in the room, though I doubt it will do any good. Just don't come crying to me in 2016 when your business is being propped up by 500,000 lines of crappy JavaScript...
Posted 14 years, 11 months ago on February 23, 2006