5 Earth-Shattering Things You Should Know About Ajax And Probably Don't
posted Tuesday, 18 October 2005
Ajax is hotter right now than Nicholas Carr's backside after coming out of Tim O'Reilly's Web 2.0 woodshed. You have heard, haven't you? If you're not sure then go Google "Ajax" right now. You can read over 23 million detailed entries all about it. Literally. Though you will have to skim a bit.
Of course, you already know everything about Ajax, don't you? You'd have to be living on some deserted island not to know about the new uber-chic way to build cool looking, dynamic Web clients. And all without a single plug-in from Macromedia! Well, perhaps you're a retired Visual Basic programmer and haven't been getting out much lately. Or were just plain unlucky and missed the trendy article in BusinessWeek.

Otherwise you've surely heard that Ajax is the total panacea to the all the problems of traditional Web applications. This includes (but is not limited to, no!) bad navigation experiences, long page reloads, lousy interactivity, web service integration, native application envy, and even the solution to world peace. Yes, it's all there.
Except, dammit, the bad news is that Ajax is NOT really as perfect as they say. No. Probably not even close really. Yes, I know, I'm calling everyone's favorite baby ugly. But fawning write-ups do sell magazine articles, books, and page views nicely, don't they?
The truth? Well, the news isn't actually all bad. The patient isn't immediately terminal. Just misdiagnosed really.
So what do you really need to know about Ajax right now, this second, tonight? Especially if you haven't taken the plunge yet?
1) Ajax and XML, A Match Made by Acronym - Ajax and XML actually aren't necessary for Ajax. No, not at all. Ajax actually prefers JSON! What the heck is JSON you ask? It's the JavaScript Object Notation. It's a much better way to transfer and parse data over lightweight HTTP services. Waaaay better than XML/HTTP, REST, or even, god forbid, SOAP. Don't even ask about WS-*. Don't believe me? Then read the docs on the eval() function in JavaScript. Good, huh?. Next test: Try to send lists of data in XML to your Ajax client and not get tired out writing the (inevitably buggy) DOM navigation code. You'll switch to JSON. Your HTTP service developers will thank you. And everyone will be happy. Well, except folks that want interoperability and performance over ease of programming. Those obviously picky folks should just stick with XML, particularly if they've already heard of it.
2) Ajax Is Faster Than A Wet Dog - In reality, JavaScript these days is mind-bogglingly, scorchingly fast. Especially now with 4Ghz client computers easily available for less than $500. Unless of course you're using Firefox and XSLT (and see point #1 above about XML in general). Other than that, so fast is JavaScript that the asynchronous part alone can bring the very biggest, brawniest enterprise servers in your datacenter to their very knees. If they had knees, that is. Think thousands and thousands (and thousands) of lines of JavaScript per second. That's really, really fast. This means incredible and/or extremely stupid JavaScript tricks can be done to amaze and impress your web site's venture capital investors visitors in the Web client. Or issue thousands and thousands of HTTP requests per second to your unlucky server if you aren't very careful. Either way, lots of people will notice. Use the power wisely.
3) Never, Ever Forget That The Web Is A Real Jungle - HTML is the lowest common denominator, not JavaScript, not XmlHttpRequest, not XML/XSLT. Sure, most civilized people have those things and if you only want to reach a nice, boring, homogenous group of folks running only the very latest, shiny new browsers, then you're all set. But Ajax, especially heavy duty Ajax, will absolutely, certainly cause you to leave a lot of folks behind. These could be folks with cell phones, PDAs, Internet watches (when they're available), and anything else (especially <shudder> antiquated computers) that you couldn't possibly imagine that folks would use to load your site up. And if they're your customers or otherwise people you care about, then maybe, just maybe you should just get rid of them, no? Folks that don't keep up on the Web or use weird stuff deserve to be left behind, right? But you might not agree with this. And if you don't, it doesn't matter, those folks are just NOT going to be talking to you, that's for sure.
4) Windows Is Dead, GoogleOffice Will Take Over Everything, And We're All Just Living in Sergey Brin's World - OK, no, not really, but you'd have thought so until Google Reader turned up and the blogosphere let out a collective sigh realizing they can't hold their breath that long. Ajax will not kill Windows (the pretty darn cool Bindows notwithstanding, those guys are crazy enough and good enough to actually do it, not those rank amateurs at Google). Seriously though, Windows probably is dead, but Ajax won't be the one killing it. The current install time for Vista is so long that most people probably just won't live through it, and they'll just punch up Gmail or Meebo while they're waiting anyway. What I'm trying to say is that building Ajax applications using an ancient, crufty model for end-user programs that was devised in the 1980s probably isn't such a hot idea. In fact, I'll go out on a limb and say it's plain stupid. There are better ways to do things now. Smaller ways, more integrated ways, more Web 2.0 ways. So don't build elephants with Ajax, build mice.
5) Web 2.0 and Ajax Are Not The Same Thing - Sure, lots and lots of programmers that don't have a clue about the social aspects of anything will claim Ajax is Web 2.0. I've heard this one over and over again. More importantly, I'm a programmer myself, so I know. Web 2.0 is about collaboration, information sharing, ad hoc enrichment, participation mechanisms, and open and loosely coupled connections between services and people (not that anyone will actually let it happen). It is true that Web 2.0 places are much friendly, cooler, and sometimes a lot better with Ajax. But Web 2.0 has no more to do with Ajax than venture capitalists have to do with Internet startups; sure, they're often seen together, often work/sleep together, but are in no way necessary for each other's existence. Get over it, Web 2.0 is a mindset, Ajax is a set of technical approaches. Don't mix them.
And so, that's all you really need to know about Ajax. Well, you might want to buy a few books, read up on the latest web sites, and buy an Ajax IDE and go to a few training classes if you need to, and even mingle with people that know it, but only if you absolutely want to. Take care out there.
Editor's Note: Your regularly scheduled "serious post" about Web 2.0 will return tomorrow.
Technorati: web2.0, ajax
links: del.icio.us