JavaFX is a new (less than one year since release) software platform for building Rich Internet Applications. Having undergone three major releases so far within its first year, it’s rapidly approaching the point where people could reasonably expect it to be a viable choice for building real applications. That might be the expectation, but what is the true situation? I wanted to understand where JavaFX really is in terms of browser-based applets. So, I set up a small test on this blog to look at the critical issue of app deployment. I asked people to leave their findings in the comments. Thanks so much to everyone who took part – I certainly found the results illuminating. In this blog entry, I’ll report back the findings of the test and what these could mean for future development of JavaFX technology. I’ll also discuss what I think the potential sweet spots for JavaFX applets could be in terms of types of browser-based apps.
Why Applets Are Important – Augmenting Browser Functionality
Before considering JavaFX applets in detail, it’s worth a moment to step back and ask the question: why are applets important? Clearly, their reason for existing is to augment the functionality of a web browser. For example: to play audio or video; or to allow sophisticated graphics for video games or other apps with complex graphics needs.
Now, many people will argue that the JavaScript/HTML/CSS is on a trajectory such there will soon be nothing the browser won’t be able to do natively, and thus the reason for Flash, Silverlight and JavaFX applets will disappear. They may be right: not having to rely on browser plugins is an highly attractive idea.
However, life is rarely that simple, and the future might not be black and white. The truth is: future JavaScript/HTML/CSS represents strong competition for Flash, Silverlight and JavaFX. What the future ends up looking like, though, will depend on how the various technologies compete. There are battles to be had in: developer productivity for creating compelling applications; and application deployment etc.
Results Of The Test
Start-up Time – Observations
First the good news – if you’re lucky with your hardware/OS platform, and you have an up-to-date install of JavaFX, JavaFX applets can start in around one second. That’s a great result, and a huge improvement on where the Java platform has been historically.
However, what the test results really show is that the above case of super-fast start-up is very much about the future potential of the technology. It’s clearly not where the technology stands today. In fact, the frequently observed start-up times in the test ranged from 1 second to c. 45 seconds, with start-up taking even longer than this for some people.
The applet used in the test is a small applet, about 30KB in total. Thus download of the applet itself should not be a significant contribution to observed start-up times. So, what is the wide range of start-up times due to?
It turns out that there are two major determinants of the start-up time of a JavaFX applet: 1) The hardware/OS platform of the user – which determines which version of Java and the Java Plugin they can use; and 2) whether or not up-to-date jars for the JavaFX run-time are installed, or whether they have to be updated on-the-fly during applet start-up.
For users running MacOS X, the start-up time for the Java Plug-in is slow (perhaps 8 to 10 seconds), even on new hardware. On Windows hardware, the corresponding start-up times are between 1 and 5 seconds.
For users that don’t have the latest JavaFX jars installed, depending on broadband speed e.g. 2Mbps, 5Mbps, it will typically take between 15 and 30 seconds for the 14MB or so of data to be downloaded.
Clearly, those end-users of apps that are worst off are people using Mac OS X and that don’t have the latest JavaFX jars.
Rendering & Other Bugs
Certainly on both Windows and Mac OS X, there can be terrible rendering bugs in JavaFX applets when the web page in which the applet is embedded is scrolled. On Windows, sometimes the web-page stops rendering immediately after the embedded applet, so all content below the applet is lost. JavaFX applets don’t work at all in the Opera browser or in Safari 4 on Windows.
What Role Can JavaFX Applets Play Today?
The rendering bugs in JavaFX applets are sufficiently bad as to make applets embedded in web pages that are likely to be scrolled an unacceptable choice for developers. That rules out applications like fancy embedded graphs and charts or embedded video players.
The variation in likely start-up time for a JavaFX applet – anywhere from 1 second to 45 seconds – without a good way of communicating what’s going on to the user – mean that only categories of app where the user is prepared to wait 30 seconds or more for their application to start are going to be possible choices.
The above suggests that the sweet-spot for JavaFX applets today is for building creative, browser-based video games. The elegant JavaFX programming model should make it productive to develop interesting games on short timescales. As an example, here’s a preview of a neat JavaFX game called Pastello which is heavily inspired by the popular indie game, Crayon Physics (I really recommend clicking through to Pastello, by the way – it’s an impressive piece of work).
Driving next stage of JavaFX adoption
Casual games are, of course, an interesting and substantial category. However, if that’s all that JavaFX applets can achieve, I think we have to say they’ve been a failure. That’s because it will mean JavaFX applets wouldn’t have moved the Java platform forward – the truth is, regular Java applets have always been pretty widely used for browser-based video games.
How then, to drive the next stage of adoption for JavaFX applets?
Rendering bugs on scroll must be fixed in order for JavaFX applets to take off for visualization applications. The variation in start-up time means that users expectations must be managed. As a first step, it will be important to let the user know it might take up to 45 seconds for the app to start up if they’re on a Broadband connection, and even longer if they’re on dial-up. However, that’s very much a workaround. What are really needed are progress bars that can be shown embedded in the web-page (and styled by the developer) to indicate download progress. Indeterminate progress indicators – like the spinning animated gifs developers can use now – are useful; but they are a really poor second choice to determinate progress indicators for long JavaFX start-up times that will have to be accommodated for some time yet.
Conclusion
Hopefully, the JavaFX and Java SE teams have been aware of all the issues brought to the forefront by this test for some time; and they already have solutions in the works. If not, I hope they take on board the clear findings from this test, and the likely consequences for JavaFX adoption: that is, rendering bugs and long start-up times with no effective progress-indicator-style feedback will put a massive brake on developer adoption for JavaFX applets until these issues are addressed.
Results Of The Test