Published: March 17 2006

There's hardly ever been a term in software development which has been picked up, digested and (ab)used as fast as AJAX (Asynchronous JavaScript and XML). Thirteen month after the acronym was coined by
Jesse James Garrett
there are more than 20 English books listed on the topic, many of them already in print.

My personal dive into the AJAX sea took place early this year when I tried to come up with a simple demo application to show the practices and pitfalls of Test-Driven Development with SAP's Netweaver technology. My colleague Marco and I decided to use two technologies to show the universal applicability of our approach: WebDynpro (the SAP way to generate web user interfaces) and plain JSPs.

It didn't take me long to realize that WebDynpro was going to be a real pain in my behind, so I kept morale up by adding a couple of AJAX features (inline editing, drag&drop, no page rerendering etc.) to the JSP variant. Although I had done some reading on AJAX implementation techniques and patterns, I ended up with a solution of almost 500 lines unreadable JavaScript code, which - to make things worse - only worked with my specific version of Firefox.

So I decided to do it right for once. My goal was to implement the same thing over again, but additionally I intended

  • to leverage the best Javascript and Ajax libraries available.
  • to have automatic tests for both server-side and client-side code.
  • to make standard stuff (like communication and dom handling) as easy as possible.
  • to come up with a cross-browser-enabled solution.

In case you wonder, these are the exact goals of many of the 500+ existing AJAX frameworks.

Being the thorough guy that I am once in a while I started by purchasing (and reading) a couple of books:

Additionally I subscribed to Ajaxian which IMO is a very convenient place if you want to learn latest news about Ajax technologies, libraries and applications.

In the stories to come I'll probably ramble about lots of details like client-server communication models, browser (in-)compatibilities, JavaScript effects, testing, templates and a few more. For today I send you to bed with the most striking lessons I learned in the last two months:

  • If you want to make a really cool Ajax application, you won't get around programming in JavaScript. You'll probably be able to make use of many useful libraries for communication, effects and widgets. But that only gets you so far.
  • JavaScript is not a bad language per se. What really sucks is the bad support for debugging and testing. I have yet to know a JS debugger that works with the latest version of either Firefox or Internet Explorer. The JS interpreters in Firefox and IE are not even able to recognize all syntax errors or to produce sufficient error messages from compilation and runtime errors. IE doesn't even tell you about the real line number in which an error occurs.
  • Browser incompatibilities slow me down much more than I would have guessed from reading the books. Although I'm using libraries which are supposed to hide the cross-browser issues I spend at least a third of development time to sort out the problems when getting Firefox ready code to work in IE. And I haven't even tried Opera and Safari yet.

The produce that I accomplished during the last two months (working mostly in the evening and on weekends) is a little framework called JayJax. There's no release yet, but there will be one soon. And I will present you all my lame excuses why I just couldn't resist writing yet another one...

Johannes

blog comments powered by Disqus