Has the JVM design been holding back Java?
Update:Looks like the post has been linked from DZone. Tell me what you think? What kind of projects would you choose Java applets over Flash or AJAX?
After all these years, Java’s applet has not seen much adoption, while Flash continue to gain mindshare. Applets suffer from slow start up times, crashing browsers, heavy resource usage. The latest ‘solution’ from Sun is to keep the java libraries in the disk cache.
The latest client-side offering from Sun – JavaFX – improves the language, but does nothing about the underlying JVM itself (more about JRE 1.6u10 later). JavaFX is a fine language, once you get past the YAML syntax. Unfortunately, the JVM itself it the issue. JavaFX or not, Sun will not see JavaFX overtake Flash on most web pages.
When Flash 1.0 came out, it supported streaming bytecodes, and movies played immediately. JVM’s design requires all libraries to be downloaded, and then verified before playing in the sandbox.
The JVM implements share-nothing class libraries1, every new JVM process requires run-time libraries to be loaded up separately. This adds another block of run-up time before any screen is visible.
The JVM has a fundamentally flawed approach when the use-case is to run in a browsed environment, i.e. where people are moving from web page to web page quickly, and only having a taste of your application, and sometimes, involuntarily, as in the case of a banner ad1.
For browsing environments, I contend that Sun should have bundled some sort of interpreter in the VM, that can process a streamable language, in the manner of Flash. Sure, it is not Java, but it would have guided the evolution of the JVM. For example, we would have arrived at MultiVMs and OSGI much faster.
The Java camp has a reputation for dogma, e.g. rejecting delegates in favour of anonymous inner classes, static methods instead of standalone functions. There are promising signs of change. Invokedynamic and Annotations are nearly here, thanks to realization that the JVM needs to support dynamic languages, and thanks to competition from the .Net camp.
Sun engineers ought to ask themselves this question. “JVM is everywhere. What is Flash doing right but we aren’t?”