Java LiveConnect
Just watched an interesting presentation on Java LiveConnect. The concept is that you embed an applet in a DHTML page that has no visual component. You can then communicate with Java objects natively within your JavaScript application.
The benefit of this is fairly obvious. Firstly, you can then use compiled code to contain your business logic in a way that is not easily accessible to the user. Also, you can get marked performance improvements by handling complex logic within the Java VM. Lastly, you can take application logic that you’ve used written on the server side and deploy that logic into your application to save yourself come code duplication.
The other component that was demonstrated was the use of Java DB (Apache Derby) as an offline data store to allow you to take your web application offline.
The drawback of this is that it requires the user to have the Java runtime installed on their machines. This is easy to assume on the Mac, as the Java runtime is included in the default install and maintained through automatic software update. On Windows, however, the user is required to have manually installed Java on their systems.
What about Flash? Many (but not all) of the benefits available here can be achieved using the Flash player instead of the Java VM. What are the trade offs? Well, ActionScript 3 is a strongly typed, object oriented language just like Java. Adobe Flash Player 9 is surprisingly fast, though I haven’t seen any benchmarks comparing it with the Java VM. The Flash player is installed on the large majority of computers out there. The drawback is that there are WAY more libraries available in Java. There are way more developers out there that know Java. Compiling and debugging tools in Java are way more robust. Flash does have a simple persistence layer, but it has to be explicitly enabled by the user and it’s nowhere near as robust as something like Java DB.
My recent experience in developing JavaScript applications that hand large amounts of business logic on the client side dictates that the current JavaScript runtimes available in browsers are do not provide good performance. It’s going to be a long time, if not forever, before we see the JavaScript runtime be fast and the same across browsers. With the relative ubiquity of Flash and - to a lesser extent - Java, it seems like a worthwhile endeavor to attempt to move most of the application logic elsewhere and use JavaScript purely for the presentation layer.
May 8th, 2007 at 1:43 pm
My analytics data tells me that 93+% of the visitors to this site are Java enabled. That’s a pretty big percentage. By contrast, 100% of my visitors have some version of Flash. 98% of which have Flash 8 or higher. It should be noted, though, that my readers are not a fair cross section of the general populous.