I’m trying to understand what JavaFX, which Sun just announced at JavaOne, is about. So far as I understand, it’s a scripting language designed to make it easier to create user interfaces. Okay, fine, but it’s still a bit vague, so I turned to the FAQ, and in particular, to two questions that were the most relevant to me:
Why do I need the JavaFX Script? Isn’t Swing good enough?
There’s nothing wrong with Swing. Swing is one of the best GUI development toolkits of its kind. Swing makes it very easy to create standard GUI components, buttons, listboxes, trees, and tables. Together with Java 2D, Swing makes it easy to customize existing components or to create new custom components to achieve virtually any desired visual effect. Sun is not replacing Swing with JavaFX; instead, JavaFX Script makes Swing much easier to use.
With the new JavaFX Script language, the structure of the programmer’s code closely matches the actual layout of the GUI, making it tangibly easier to understand and maintain.
Ugh… Well, can I have a real answer now? Isn’t Swing good enough? There is absolutely no explanation why they are inventing another layer (or is it a new UI? I still don’t know at this point, despite reading the FAQ twice now).
Alright then, let’s turn to the second question that’s burning in my mind:
Why isn’t Groovy enough?
Groovy and other languages have two specific traits which don’t precisely meet these needs, namely that they are generic in nature and don’t provide the appropriate abstractions necessary to optimize the UI design process and similarly are designed specifically for programmers other than content authors.
Are you kidding me? “Generic in nature”? What does this even mean? Do these people even know about Groovy? Or about the SwingBuilder and other MOP-inspired constructs that you can use in Groovy to make the declarative/imperative impedance mismatch all but disappear?
If you’re going to explain why you didn’t pick Groovy in an FAQ, there are plenty of reasonable justifications you can come up with (memory footprint, dependencies, etc…). But… *that*?!? Come on.
Looking at the examples further, I see code snippets that are actually a severely crippled version of what Groovy can do. JavaFX appears to have some scripting abilities but it’s yet another language with its new syntax and rules. For example, the symbol for inequality is… <>. That’s right, <>! I’m guessing the creator of JavaFX likes Eiffel. Too bad the rest of the world hates it.
By the way, can we have full code completion, code browsing and folding in our IDE for this new language?
More than frustrated by the FAQ, I turn my attention to the demos and tutorials and I start to read. And here is the kicker:
Before you begin, you must install the following software on your computer:
* NetBeans IDE 5.5 (download)
* JavaFX Script plugin for the NetBeans IDE 5.5 (download instructions)
That’s right: you need NetBeans to run JavaFX.
And suddenly, it all makes sense.
Desperate to get developers to adopt NetBeans, Sun has found another way to try and lure them: invent another framework, come up with a few reasons to justify its existence and in the tutorial, mention in passing that you have to download NetBeans to even write a Hello World example.
Look, Sun: JavaFX is a simple library. A jar file. A bunch of class files. I’ll be happy to add javafx.jar on my class path and import javafx.ui.* (although… it’s a highly non-standard import name. Did you forget the convention that you helped define?… How about org.javafx?).
But tell me again: why are you forcing me to use NetBeans?
Sun needs to understand that we, Java developers, are not satisfied with just using an open source version of Java: we hate proprietary lock-in. We want choice. And we want Sun to respect the choices that we made to write our Java code and acknowledge that not everyone (actually, very few of us) are using NetBeans.
The timing of this announcement is quite interesting actually, since I was telling a friend just this morning that I was sad to see that despite his active blogging, Jonathan Schwartz never *ever* says anything about Java. Most of his blog posts are about Sun strategy and marketing material, and it’s been obvious to me that Java stopped being Sun’s priority a long time ago. This morning, I fire up my trusted Google Reader and I see that Jonathan is talking about Java! Not that this comes as a surprise: this is, after all, JavaOne week.
But breaking the year long no-Java-mention embargo on his blog by introducing JavaFX is a sad reminder that Sun does, indeed, care very little about Java.