JavaFX 1.0 considered
Wednesday, 10 December 2008
JavaFX 1.0 is finally out of the gate. There are probably many Java engineers and architects who are trying to figure out this technology and see how it could apply to their existing projects. Here is my assessment. Note this applies to JavaFX 1.0.
JavaFX 1.0 is not ready as a Flash replacement in public-facing projects
While slow start-up time has been largely addressed by JRE 1.6 update 10, it is not widely deployed (3.7%). For some strange reason, my machines would not install JRE 1.6u10 until JRE1.6u7 has been installed. Perhaps Sun engineers could explain why?
The runtime is still heavyweight. When the applet starts up initially, my development machine – which had Netbeans loaded – started thrashing the HDD, and the browser’s message loop was tied up for about 10 seconds. On lesser equipment, running JavaFX applets will be a distinct negative experience.
Furthermore, the new (applet) browser plug-in only works on FireFox 3 and Internet Explorer. There has been reports of browser instability, especially on the Mac.
JavaFX 1.0 will have mobile runtime – but not yet (as of Dec 2008)
Sun is positioning JavaFX at the mobile devices market, but no runtime have been released yet. Note that although JavaFX builds on the JVM and applet technology, it uses native DLLs to take advantage of underlying graphics chip. Conservative engineering means one has to be judicious in applying special animations and effects, especially on the mobile platform. I noticed that the JavaFX SDK ships with a JavaFX emulator (in the javafx/javafx-sdk1.0/emulator directory), I tried it, but didn’t have much luck with the pathanimation demo.
However, there is no doubt behinds Sun’s determination to see JavaFX succeed. Sun has pulled engineers from Swing and other projects to ship JavaFX 1.0.
JavaFX 1.0 is not ready for line of business applications on the desktop
Don’t get me wrong, JavaFX can be very productive environment to develop in, compared to Swing. Furthermore, JavaFX is (apparently) embeddable in a regular Swing application. However, the javafx.ext.swing package does not contain a DataGrid implementation, nor provides any guidance on how to handle virtual tablemodels. POJO classes will have to be rewritten to support property change notifications. For companies willing to experiment, there are several projects which implement custom classloaders to retrofit java classes with this ability. Sun should annoint one for use in their internal projects in order to improve code-quality.
JavaFX 1.0 is suitable for internal test deployments of media applets, games and simple proof-of-concept applications
We can’t get to JavaFX 2.0 without getting to JavaFX 1.0 first. While the platform is relatively immature, it is still useful for simple scenarios. In a corporate environment, where there is plenty of bandwidth and where standard operating environments is relatively easy to specify, JavaFX 1.0 can be useful for proof-of-concept applications.
Technical assessment of JavaFX Script
Java as a language is hobbled without a macro system, and as a consequence, JavaFX script has to be invented to
- remove the tedium when writing plain objects with propertyChange support,
- improved support for background animation threads and
- scenegraph layout code that reads more like layout than code.
It is somewhat surprising that Sun has not gone down the route of retrofitting Java with syntactic sugar, as Microsoft did with C# did using object initializers, but is introducing a brand new language instead.
Pragmatically, Sun has chosen not to standardize JavaFX script. This leaves the door open for more language tweaking. However, JavaFX script still lacks the dynamism of Javascript. Perhaps Douglas Crockford can show us how to flex JavaFX around as he did with Javascript.
JavaFX runtime vs HTML
I hold some strong opinions regarding this. Out of the three RIA platforms from Microsoft, Adobe and Sun, only Microsoft’s Silverlight retains the advantages found in web applications. These are
- Text selection
- Bookmarkability
- Text search
The JavaFX 1.0 runtime to date will not render rich text. JavaFX content is not indexable by web crawlers.
As such, JavaFX is not a substitute for text-heavy applications, like a bug tracker, or a blog – a web application’s equivalent of a “Hello World”.
There is no CSS support in JavaFX 1.0 [thanks El Cy], which is like programming without variables. One will have to touch sources at multiple points to effect a style-change.
The development experience is poor when compared to HTML. JavaFX is compiled rather than interpreted. As such, think of JavaFX as first Java, second Web, and has a lot of ground to catch up before it gains the same kind of ease-of-use compared to HTML.
From an adoption standpoint, Sun may gain mindshare of applet developers (from a very low or non-existent base), but will struggle to convince the millions of web-developers out there that Edit-Compile-Debug is more desirable than what they already have.
Conclusions
JavaFX 1.0 is not ready for prime time deployment. However, given Sun’s posturing, it is safe to conclude that Sun will continue to throw resources at the client-side. In order to ship JavaFX, a host of long neglected client-side bugs and issues have already been addressed. Watch Sun, and I can’t wait for JavaFX 1.1.
I’d appreciate any comments, corrections or questions.
You should follow me on twitter here
No. 1 — December 11th, 2008 at 1:47 am
Actually CSS support is included but not very obvious highlighted documented. Check javafx.scene.Scene for stylesheets
No. 2 — December 11th, 2008 at 1:50 am
re CSS also take a look in javax.scene.CustomNode for style and styleClass
No. 3 — December 11th, 2008 at 2:11 am
While I don’t agree at 100% with everything, it’s a pretty honest and reasonable report. I’d like to comment on this point:
“JavaFX runtime to date will not render rich text. It also does not support selection, bookmarking, searching. As such, it is not a substitute for text-heavy applications, like a bug tracker.”
While this is clearly a JavaFX lack (but Sun is working on that, Alexey Ushakov has just posted on Java.Net announcing the first early access of the new JWebPane component in a couple of months), I really don’t see anything such as bug tracker in JavaFX (or Flash). Indeed the release of JavaFX (and Flex/Air on the other side), should hopefully make clear a big architectural mistake: that a web site / web application is the same thing as RIA. This doesn’t hold true in my opinion. A blog, or a newspaper online, or a issue tracking service are web applications, that is they are best made as HTML pages. One could argue that a RIA could, for instance, make it possible to use an issue tracker in disconnected mode – BTW, I’m a big fan of disconnected mode. But IMHO the correct solution is a separate client for that (see the rich client for JIRA as an example). A complex cataloguing system, rather than a site to book a plane, are something that is better suited for a RIA. There’s a large gray area, where I see web application with single, small and focused applets, such as web galleries and simpler services. At the moment I don’t have a strong opinion where the boundaries for the inner gray area are, but I’m pretty sure that we need RIAs in JavaFX (or other technologies), still we will have lots of regular HTML sites.
No. 4 — December 11th, 2008 at 7:59 am
Great comments Fabrizio. I have seen one RIA platform (can’t remember the name) where each GUI element is addressable, therefore keeps the best of the web on RIAs. I haven’t seen any attempts to do that on the Big 3 (MS, Adobe, Sun). Big mistake, as they are throwing away a lot of lessons learned from 20 years on the web.
No. 5 — December 11th, 2008 at 2:54 pm
RIA VS Browser
This is JavaFX v1.0 (more to come next year). It is a RIA platform that targets multiple devices so it is not answering the same goals as HTML and it is certainly not behaving like some other browser plug-ins, and not like Silverlight since JavaFX let you get out of the browser so you don’t need it to run your apps like with Silverlight.
Business Applications
As for business applications using JavaFX DataGrid would be a key component, but most apps use grids to actually display elements and for editing you present a decent form. So content presentation as lists are even more important and the platform demonstrates that it is very possible in a fast way. Last time I created a simple VisualTree in silverlight my old pentium was not able to run it too.
Selection
Selecting content in Silverlight or JavaFX as one use to with HTML seams like cutting carrots with a Saw.
May I ask how you did achieve that? My team and I have not been able for the last 2 years.
RIA are like rich desktop applications, if you want to select content within RIA, chances are that you want to copy it somewhere or print it. Chances are you would like to generate clipboard content or PDF for that purpose.
Performance
I don’t see JavaFX as inferior to Silverlight at this point of time. There is the same potential, comparable execution performance for the same tasks. JavaFX has 3Dand hardware acceleration as it is based on OpenGL. These features are not found in Silverlight 2.0 yet but so we hear “planned”.
Programming model
I think this is where you will see the difference. There is no XAML in JavaFX. It is a declarative language and it resembles what Flash and Java developpers have used since more than 10 years. Plus all your java code is usable and you can use the free IDE Eclipse compare to buying one of the flavors of Visual Studio.
Deployment and installation
Please tell me you have no problem with the installations betas of Silverlight. Seriously call it 2.0 or 1.0 or beta, its all the same. These platforms are new but JavaFx 1.0 certainly is there to stay and battles 1.0 versions of many other RIA platforms.
No. 6 — December 11th, 2008 at 3:32 pm
@Vince JavaFX has potential, and I wish it success if only to keep MS and Adobe honest. However, on my initial assessment JavaFX 1.0 is not ready for prime deployment. RIAs have a special place in the deployment ecosystem, but frankly, I have no idea where.
No. 7 — December 12th, 2008 at 4:15 am
Silverlight is new too.
I see both as being from different approaches.
Silverlight is closer to WPF way of building applications and for that might get close to the conventional line of business way of doing things. DataGrids, ListBox, Combobox, etc. You can extend the UI of all these controls in Silverlight.
The paradigm and approach seams different with JavaFX. No XAML is sometimes an advantage to complexity of what you try to achieve using RIA.
Primitives are used to create a UI that can be expressed using a declarative scripting language.
With java code behind that has the same equivalent performance you might get with .NET compiled XAP files.
No. 8 — December 13th, 2008 at 2:59 am
JavaFX is a great approach but not sure why Sun or Microsoft are coming so late to the game in challenging Flash. With the advent of Google Chrome and the browser wars to follow – the browser JavaScript Runtime is going to win out. Folks should be creating DSLs over this runtime.