(Asynchronous JavaScript and
XML) is a competitor to Applets. AJAX is not a language or a
software package or even an interface. It’s a word someone invented for the generic concept of having JavaScript
talk directly to the server without reloading the HTML page. There are any number of possible ways of implementing AJAX.
The most common is to use the non-standard XmlHttpRequest class, which is available from
JavaScript in most major browsers.
The major defining characteristic, though, is the asynchronous aspect of the technology. Even XML is in there by
coincidence; people describe things as “AJAX” applications when they don’t use XML at all. There is no
new language or file format here. There’s no specification; no definition of what AJAX is or is not. There are no
special tools. There’s no visual appearance that could be created except what you could do with a web browser,
HTML, JavaScript, and CSS anyway. In fact, if you were allowed to stub out the data, you could write any AJAX
application with only those basic client-side web technologies.
AJAX is typically a generic JavaScript program to allow thin clients to do field validation (by asking the server)
without refreshing the entire page. Google uses it for maps. It works by sending standard HTTP queries to the server.
Your application specific code all lives on the server.
The AJAX-like approach has three main advantages over Applets.
- JavaScript generally starts faster than an Applet. The browser preloads the JavaScript run
time, but delays loading the Applet JVM until first use. The load overhead for JavaScript
gets buried in the browser start up time, when the JVM load gets blamed on the first Applet.
The JVM is a much bigger and more complex animal than the JavaScript runtime.
- AJAX is really just HTML and JavaScript and CSS, so it acts like a web browser. That is, you can resize the
window and expect to see text and tables wrapped and presented in all the normal ways. All the UI kludginess of Applets
is gone.
- JavaScript is not constrained by the same tight sandbox restrictions as Java. Your users don’t have to deal with
the geekiness of signed Applet permission granting.
Java Applets have the following advantages over AJAX:
- Java is object oriented. It won’t fall apart under its own weight as project complexity grows.
- JavaScript has many bugs and platform-specific eccentricities.
- JavaScript might be looked on as a limited or toy language designed for scripting inside a browser. Java is a general
purpose language suited for pretty well any sort of computation.
- Java security is tighter. Unsigned Applets are less potentially dangeous. Sooner or later after a major scare, corporate
America is going to ban JavaScript from their machines because of security risks. At that point, all legitimate Ajax
code will stop working, so I consider it irresponsible to go the Ajax route.
Microsoft has embraced Ajax and renamed it Atlas, which
presumably means they are busy figuring out how to lock Ajax apps into Microsoft and make sure Java apps stop running.
Books
 |
recommend book⇒Pragmatic Ajax, A Web 2.0 Primer |
| | paperback |
|---|
| ISBN13: | 978-0-9766940-8-3 |
|---|
| ISBN10: | 0-9766940-8-5 |
|---|
| publisher: | Pragmatic Bookshelf |
| published: | 2006-04-10 |
| by: | Pragmatic Bookshelf |
| Covers Ajax with Java, .NET, and Ruby on Rails server frameworks. |
|