Old skool AJAX
I was thinking about how I used to program Java before I got hooked onto Flash. I started on Java because of its conceptual beauty. And I loved how all the academic OO concepts taught and studied at the University could be tested and implemented in Java. Hell, I even swore Composition Filters amounted to Object Oriented Salvation for a while
.
My thoughts wandered back to my first java projects at TriMM back in 1999 and onwards. My boss at that time loved to set a challenge and this challenge involved hiding an applet in a hidden frame of your browser to abuse it for html code generation. The applet would implement a command style pattern, processing the given commands in an asychronous thread, generating HTML. Even back in 1999 it was possible this way to provide a LOT of functionality on the client side, relieving the server of heavy duty processing. The AppletWrapper principle, as it was called, used html, a javascript layer which hid the applet details from the html and provided a javascript command queue, which would wrap all asychronous communication with the underlying applet.
The applet could do a lot, and even more when it was signed. For example even back then, it could download a zip file containing a small database, extract it in memory on the client side and read and process the data to present it in a particular format. At one point the client decided he wanted to deliver the website on cd as well, and migrating the webcontent to cd was basically a copy and paste action (with respect to the applet). The basic principle was applied many many times, eg we had table selection mechanisms, dynamic tree displays, and an offline search engine on the cd. The applet could read zip files, access databases (the applet would run from the cd, open a nameless ODBC connection to an MSAccess database also on the cd, perform sql queries on the data and generate the results through templates from a zip file, and deliver the content back to the browser).
Now that Flash is catching up in AS3, a lot of people go oooohh and aaaaahhh, but the fact remains, java had some good things going. The reason I’m speaking in past tense is that I’ve been away from Java so long, that I’m not confident the problems it had have been solved. One of the biggest problems was the platform compatibility. These java applets had to run on all windows platforms, all mac platforms, linux, unix etc. And let me tell you, that was pretty difficult. Luckily since the applets were code generating applets, we didn’t have to deal with AWT or Swing, which made things a hell of a lot easier. And due to the generality of the codebase (a particular implementation of this principle could reuse about 90% of the codebase of a previous implementation), each application we built took less time.
Still, we might be migrating some of them to Flash and I’m excited to see whether this will be possible. One other fun fact is that for a few years AJAX and Web 2.0 have been buzzwords and we were building applications on this principle back in 1999 without fully realizing how damn cool it was.
You want a demo of the stuff I’m talking about? No problem
. Note that java and javascript is required.
Of course during the years functionality was added, but the principle remained the same. Projects the other way around occurred as well, we started with a cd application which could be distributed and then the client decided he’d like the application to run on the web as well. In one particular case we simply copied the cd to the web, including the interactive applets, migrated the MSAccess database to MySql and updated the database connection string for the applet.
This turned out to work quite well, but we were defeated by simple firewall issues (the applet couldn’t make direct mysql server connections from the client’s side on a lot of locations, such as schools and company intranet sites). We rewrote the applet to a servlet which the same queue processing functionality, included a ServletWrapper in the HTML layer instead of an AppletWrapper, abiding by the exact interface the AppletWrapper had, and the problem was solved, a local application became a server application with minimum effort.
November 16th, 2007 at 12:10 pm
[quote]Still, we might be migrating some of them to Flash and I’m excited to see whether this will be possible.[/quote]
With some luck, the selection guides will be implemented in Flex…