AjaxA reader from Omaha, NE writes:

Dear Klep,
What are your thoughts on this whole Ajax phenomenon in webapp development?

That’s a great question. It’s almost like I wanted to answer that question and fabricated the query just to set up the situation.

Ajax is a term that describes an idea. In tech, we don’t get many terms that describe ideas. We have lots of terms for methodologies, but Ajax isn’t really a methodology because it doesn’t really prescribe a method for doing something. Ajax is most commonly defined as the combination of JavaScript and XML over HTTP to allow page changes without a full page reload. But that’s really just Ajax as a group of technologies. The idea behind Ajax is that by sidestepping traditional notions of how HTML pages are built and modified, you can provide a richer experience.

I am totally 100% supportive of Ajax as an idea. I think we’ve been yearning for better interactivity on the web almost since it began. I think it was around 10 years ago that Macromedia shipped a Netscape plugin for Director and I thought we’d get the kind of interactivity we wanted. Of course, it wasn’t open and didn’t catch on until it became Flash and we finally got to play Dress Up Steve Jobs in our browsers. I had high hopes for client-side Java until I used it. And even then, I thought that it would eventually cease to be annoyingly slow. Then I started to code in it and realized that it was too heavyweight of a solution — we needed something simple on the order of HTML.

So now the claim is that JavaScript is the answer and it’s been right in front of our noses all this time. I say, “Fuck JavaScript.” It’s unwieldy when trying to show and hide parts of a page, and now you want me to base my application’s interactivity on it? I think a lot of people are giving JavaScript another chance now that they see what’s possible. But the things we don’t like about it are still present. Developing JavaScript involves a lot of trial and error. Manipulating the DOM through JavaScript is non-standard and cumbersome. When used for Ajax, it almost certainly brings DHTML, XML, and style sheets into the fold. So now I need to involve four new technologies just to make a scrollable map?

Everybody talks about gmail and Google Maps as the harbingers of this new approach. I only use gmail for searching, but I use Google Maps pretty regularly. I fully acknowledge that it provides a far better experience than Yahoo! Maps and I am very impressed with it. I’m proud to tell people that I’m friends with the product manager for Google Maps, Bret Taylor. But when I looked at Google Maps the first time, I didn’t think it was a new way of writing applications, I just thought it was a great hack. I worry that that’s all that Ajax as a group of technologies really is — a hack. We’ve seen JavaScript hacks for years. Somebody writes a neat looking tree control in JavaScript. Then you look at the source and you just want to cry.

Ajax as an idea is great because it is making people confront the problem of a lack of interactivity on the web. I just don’t think we’ve found the right solution yet. Try this — imagine you just wrote Google Maps. You figured out all the browser-specific hacks and maybe even refactored the code nicely so it wasn’t all that gross. Yay! Great application! Now imagine that instead of making this application in a browser, you made the same application using a traditional client-side technology — a standard Windows app or maybe with Swing. Instead of spending your time tweaking HTML, you’d spend your time writing actual features. Instead of brainstorming neat hacks to do “client-like things” in the browser, you’d just be doing those things. And yes, I know that there are JavaScript libraries to make this easier and lots of development is happening in that area, but it will never be as easy or natural as developing a traditional client app because the web modality prevents you from thinking like an application developer.

Now is the part where I propose a solution. Two, actually. First, what the hell ever happened to web services? I was so excited about those and they never really showed up. The best aspect of web services in my mind, was that you could write a rich client app in whatever language and platform you wanted, and use XML to communicate back to an HTTP server for data. So simple! I can use server-side tools for what they excel at (business logic) and client-side tools for what they excel at (user experience). I wonder what Google Maps would be like if it was done this way.

Second, if JavaScript is in fact the answer (or part of the answer), why has it basically stopped evolving? I remember when you’d download a new beta of Mosaic and you’d read about the twelve new tags that Andreesen threw in the night before. Browsers were evolving so fast. Now when we finally all agree that we need more interactivity, we’re retrofitting old technology to do it? I wish one of the browser companies would just come out with something new and open to solve this problem. Make it so that a text field really is an object and I can call the hide() method on it or override the validate() method. We all know how these things should work but we try to fix them with bizarre frameworks and amalgams of technologies instead of addressing the core problem. Browsers all adopted new formats like PNG pretty quickly — why can’t someone propose an interactivity standard and let the other browsers catch up?

Leave A Comment

Recommended Posts