JavaScript was an antipattern, AJAX is a best practice...

A customer ask me shortly, whether I would like to evaluate the next generation technology called: AJAX to replace the Swing Client.The Asynchronous Java And XML "technology" seems to be interesting not only for developers, but also IT managers. This is really interesting. In the new economy era, ECMA,- Live- or JavaScript Language was already well known technology. JavaScript was also already widely used on the server-side. The Netscape Server "Suite Spot" was already able to use JavaScript - long before the advent of the servlet containers or API.
JavaScript was used widely on the client, but because of browser incompatibilities the developer had to develop different portions of code for IE and Netscape Navigator. Because of this fact and security concerns, IT departments begun to forbid the usage of JavaScript. I remember in one project, the "Web Design Guide" prescribed the usage of "onMouseOver" functionality, but at the same time in the IT-blueprints the usage of JavaScript was forbidden :-).
At the end of the new economy era, JavaScript was a niche solution for some beautifications of webapps and hacks. Web designers were also not very interested in that technology. Also the introduction of the acronym DHTML, didn't changed this fact. The introduction of the XMLHttpRequest object in the IE by Microsoft enabled developers to send asynchronous requests from the browser to the server. This little feature and a the renaming of the DHML to AJAX led to the current hype. The new name "AJAX" is very popular now - I only wait for the AJAX-ONE conference in Moscone Center :-).
From the technical perspective, the functionality of the XMLHttpRequest is very common and basic in the Swing framework. In Swing you can invoke asynchronously methods in a convenient way, using the SwingUtilities class. Field validation, auto completion, powerful tables, drag and drop are very easy to implement. Swing is even more powerful. Just try out the aerith application.The look and feel of aerith is really cool and from my point of view more exciting than XMLHttpObject. Even more exciting is the LookingGlass Java 3D desktop. You can build 3d applications in Java - a great extension to a media center.
From the architectural perspective: XMLHttpRequest can improve the usability of web applications. Users can become even more productive. Auto-completion, validation and asynchronous requests are an enrichment of existing applications. BUT: AJAX will remain a hack, because this technology only provides already exisitng functionality for browser environment with additional effort.
Why we should spend more time, to reinvent the wheel? This question is quite interesting and can be answered considering the non functional requirement. For internet applications, it is much easier to deploy AJAX, instead of Java or .NET. But in intranet environments, JavaWebStart can be used to deploy a Swing app. Swing provides more functionality, than AJAX, with less implementation overhead.
For internet applications also Applets can be used to provide rich experience to the user. In the past, also applets had problems with compatibility (JDBC and RMI were not supported in the IE). But now Applets are more compatible, than "AJAX". You only need the JRE, which takes about 18 MB.
I suppose we have to wait, until Applets will be renamed into another, cool name like Richlets or I-Lets :-).
In real world project, it is very important to choose the right technology. There are no silver bullets... The architect has to decide between the technology considering the functional, and non-functional requirements.
Considering the past, hyping a technology is a not always a very good idea...

Cloudy Jakarta EE and MicroProfile: Microservices, Clouds and Beyond Jakarta EE / MicroProfile airhacks workshops at MUC airport, Winter Edition the podcast:

Stay in touch:


I have returned to JavaScript after ignoring it for a long time. This site changed my mind:

Of course, to develop "real" applications, you should never use XmlHTTPRequest directly. Instead use dojo or a similiar toolkit, which covers all the brower issues for you.

Posted by Richard Rodger on July 19, 2006 at 03:40 PM CEST #


I think it is very good idea to use scripting languages as a "glue
code" INSIDE a JVM. JavaScript is very cool language, is object oriented,
has similar syntax to Java and provides garbage collection. I also like Groovy
(even a little bit more).
But there are more options available, than JavaScript in browser to build rich clients.
My feeling is here, that people try to use "AJAX" for nearly
From my point of view AJAX is only one possibility to implement a web
client.... Dojo is only a framework which hides the hacks :-).
Thanks for you comment and links. I will read the article and perhaps post
another comment :-)

Posted by Adam Bien on July 19, 2006 at 06:48 PM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
Online Workshops
...the last 150 posts
...the last 10 comments