Tuesday, May 25, 2010

O JavaFX, What Art Thou?

I have read about and started to learn about JavaFX twice and both times have been "strikes" in the sense that there wasn't enough there to really use. Both of these forays into JavaFX occurred at the time of 2007 JavaOne and 2008 JavaOne as a result of the pomp and ceremony at these conferences regarding JavaFX. Both times, I stopped wasting my time because I realized that it wasn't ready for prime time yet. As in baseball, the third strike is a strike-out, so I've been hesitant to investigate JavaFX or spend any more time on it unless I'm convinced it's finally something more than bluster and slideware.

The announced Oracle acquisition of Sun led me to wait for that third try until after Oracle had made its JavaFX-related intentions clear. Oracle has now done that and it sounds positive for JavaFX. Use of JavaFX for this year's Winter Olympics in Vancouver has also been among JavaFX's biggest and most positive recent news.

In most of my posts, I either write about things that I have learned from experience (cogitations/observations) or that I am guessing about (speculations) based on similar experiences in the past. In this post, I am going to postulate a bunch of questions about JavaFX in hopes that someone can authoritatively articulate answers to these questions. These are high level questions that I want to know the answers to before investing any more time or energy into learning JavaFX.

One of the difficulties I have encountered with JavaFX is distinguishing between JavaFX features that are and JavaFX features that are to come. Many of the JavaFX documents seem to be optimistically written about what it will do, but often in terms that are ambiguous as to how much of that is done today and how much of that is still the vision. I hope I can get clearer answers in response to this post.


What is JavaFX's License?

The JavaFX license has always seemed a little complicated, but this is not completely new as some other products have similar complicated licenses. According to the Wikipedia article on JavaFX, the Java FX license is really a collection of "various licenses for the modules that compose the JavaFX runtime" that include the proprietary runtime, GNU GPL, and the "normal" Java-esque dual license of GNU GPL/CDDL.

I'm not the first to wonder about JavaFX's license(s). Related posts on the subject include JavaFX: Sun isn't sure about the license (23 May 2007), The JavaFX Trap (1 August 2008), and The JavaFX 1.0 License - Completely Unreasonable?.


Is JavaFX Open Source?

Partly. As described in the section above on licensing, there is a portion of JavaFX that is open source, but significant portions are not. The openjfx site now forwards one to the JavaFX.com site.

Again, I'm not the first to wonder about the degree of "open sourcedness" of JavaFX. Others have posted questions on this topic in posts such as JavaFX: Open source or not? and the JavaFX forum thread Is JavaFX open-source? I particularly like the latter (the forum thread) because it nicely covers the intricacies of making a product like JavaFX open source.


Is JavaFX Standard?

As far as I can tell, JavaFX is mostly proprietary, was owned by Sun, and is now owned by Oracle. I'm not aware of a standard that multiple implementations can be written to. Despite its problems, the Java Community Process (JCP) has been the process by which "standard" portions of Java (both SE and EE) have evolved. I'm not aware of any Java Specification Request (JSR) for JavaFX? Is there one? I'm similarly not aware of any standard upon which JavaFX is based nor any implementation to compete with it directly (same syntax, etc.). In other words, is there another implementation I can switch to without changing code if I don't like something about the current implementation (similar to switching Java EE application servers or JVMs)?


Is JavaFX Java?

JavaFX certainly has the four letters "J-a-v-a" in it, but so does JavaScript (which is not Java at all). The JavaFX FAQ touts one of JavaFX's advantages being the ability to leverage Java developers' experience and one question/answer in the FAQ talks about running JavaFX applications on any device with a Java Runtime Environment.

I have a difficult time thinking of JavaFX as "Java" for several reasons. First, the syntax of F3-inspired JavaFXScript is not that similar to Java and it is my opinion that a Java developer will have as easy or possibly even an easier time learning JavaScript or ActionScript than learning JavaFXScript. Second, to me, Java is about standards. JavaFX, as far as I can tell, is in no way standard. It might be Java-based (as are Google Web Toolkit, Pivot, and so many other frameworks), but it's not Java. Third, JavaFX integration with Java is not quite as easy as I'd like for something that is "Java" itself. For more details on integrating JavaFX with Java, see Closing the Gap Between Java and JavaFX and Calling JavaFX Classes from Pure Java Code.

On the other hand, JavaFX does seem to enjoy some traits of "Java." One, it shares the four previously mentioned letters. Two, it has the "write once run anywhere" mantra of Java. Three, it makes heavy use of "Java infrastructure" such as the next-generation applet and Java ME. Four, it can use the wealth of Java SDK libraries and third-party libraries and so enjoy advantages enjoyed by languages such as Groovy and Scala.

For me, whether my client-side technology is "Java" is not all that important. What's most important is how well my client side technology interacts with my Java server-side software. This is why I've liked Flex+Java so well. I have benefited several times from the ability to easily swap clients against the same server-side software. JavaFX doesn't feel very "Java-ish" to me, but I also don't consider that to be a significant disadvantage. If JavaFX provides capability to talk to my server-side software via HTTP, SOAP, REST, and JMS like Flex does, then that's good enough.


How Large is the JavaFX Community?

This is a difficult question to answer and it is even more difficult to how large it can become. On the encouraging side, there have been numerous postings online about JavaFX. The trick, of course, is deciding if this is a sample of a large, growing, and vibrant community or is more a matter of a relatively small number of enthusiastic developers.

Java.net polls have provided some indication of how large the JavaFX community is and how large the potential community might become. There was a poll clear back in 2007 as well as a relatively recent poll. I get the feeling that many Java developers still have a "wait-and-see" attitude toward JavaFX. Considering the huge fanfare over JavaFX in 2007 JavaOne and 2008 JavaOne and the long wait after those events to get something tangible, this attitude is to be expected.

Of particular concern is David Herron's comment in his blog post The iPad, the Flash kerfluffle, Applets and JavaFX regarding attendance at the Silicon Valley Web Java Users Group:

How many of you are interested in JavaFX? A meeting of 100+ geeks in Silicon Valley who are associated with a Java User Group, you'd think a few of them would be interested in JavaFX. One person raised their hand. I think that says a LOT.



Does JavaFX Have a Niche?

Related to community size is the question of what JavaFX has to offer that might set it apart from the rest of the crowded field. It is difficult to find a front on which JavaFX doesn't have a mighty competitor to face, often more entrenched than JavaFX. For web-based RIAs, JavaFX is playing catch up with Flex and Silverlight. Many developers choose to not use Flex or Silverlight because they prefer something more standard, but that's not JavaFX (as far as I know -- see question above). Even if JavaFX was standard-based, it would have to compete with several Java-based standards (JSPs/servlets and JavaServer Faces) and with one of the biggest standards of all: HTML. HTML 5 finally seems to be gaining some traction and could be a formidable foe.

Mobile devices seems like a decent niche for JavaFX with wide availability of Java ME. However, the rapidly growing popularity of iPhone and Android-based telephones are making Objective C and Android compelling platforms for mobile devices. The irony here is that Android is arguably "more Java" than JavaFX.

With JavaFX competing for market share on the web against Flex, Silverlight, HTML 5, Google Web Toolkit, and many others and with JavaFX competing for mobile market share with iPhone and Android, the desktop seems like one of JavaFX's best frontiers for success. If JavaFX and Swing were made more easily integrated, this could be a very compelling combination.

One of JavaFX's selling points is the ability to run on all the aforementioned platforms: web, desktop, and mobile. On the surface, this is a really nice feature that could save development time and provide users with consistent experiences. However, given the significant differences in these platforms and in user expectations for applications on these platforms, I'm less sure of the value of this proposition.


Where Does JavaFX Fit with Oracle?

My belief is that the Oracle acquisition of Sun may be the best thing that could have happened to JavaFX in terms of its future viability. Oracle may be able to turn JavaFX into a profitable product and therefore justify continuing heavy investment in it that Sun started.

I think Oracle has provided a model for the likely treatment of JavaFX in the future. Keep in mind, that this is pure speculation (one of the key components of my blog's title). I think that Oracle could treat JavaFX like they have treated the Oracle Application Developer Framework (ADF). As I understand it, a developer can download ADF with JDeveloper for no charge and then purchases runtime licenses on a per processor basis (see Oracle's ADF site for complete and correct details). I've never used ADF, but I understand that it's a convenient framework for simplifying Java EE development. It is most likely not more familiar to more developers (such as me) because of its proprietary nature. It's standards-based, but is not itself a standard.

I personally am not stuck on something being open source. If the best product for my needs is not open source, then it's still the best choice. If all else is equal, I'll typically choose the open source product, but I'm not afraid to carefully use a proprietary solution (especially when it's free or low-cost) when its advantages are obvious and its use is handled correctly (sufficiently isolated and abstracted). I think JavaFX could have a reasonably successful future under the ADF model, but it's unlikely to be as successful (in terms of usage) as it would be if it was free and open source.

No matter what happens with JavaFX under Oracle's stewardship, I think it is important to remember that the much-revered Sun already had JavaFX as a proprietary, non-standard product with some open source pieces before Oracle ever had any rights to the product.


Does JavaFX Have a Future?

Since the Oracle acquisition, I have felt that JavaFX likely will be around 1, 2, and even 5 years from now. That being said, I am still not convinced that it will ever be "the" or even "a" dominant display technology, at least as it stands today. Instead, I see it as a promising alternative that might be the best fit in certain situations (such as when the ability to run on multiple platforms' screens is of vital importance) and not the best fit in many situations where a competing and likely more established technology already provides a better fit.

As I have thought about and written this post, it has felt to me like JavaFX is trying to find itself. I think it's getting closer to finding itself and, when it does, I may have to give it the third try and hope to avoid a strike-out.


Other Questions About JavaFX

Here are some other online postings of questions (and sometimes answers) related to JavaFX.

JavaFX Frequently Asked Questions

Ten Questions for JavaFX

Will JavaFX Ultimately Become a Widely Used Rich Client Technology?

What I Don't Like on JavaFX

JavaFX Basic Questions


Conclusion

In this post, I have recorded some of my questions regarding JavaFX along with my best attempt at answering those same questions. However, I'd appreciate any additional and/or corrective details that can be provided for me to better understand what JavaFX is and whether it is something I want to invest more time learning when I have competing interests in other "new things" (such as Android SDK development for my Droid).

10 comments:

Thierry said...

Quote :
"If JavaFX and Swing were made more easily integrated, this could be a very compelling combination"

--> Very true to me. javaFx could have been easilly the successor of the Swing framework.
but the truth to me is that "up-to-now" it is not simple-and-easy to integrate javaFx components into a java-swing software.

Too bad.

guidolx said...

If Oracle JavaFX Business Model is like ADF then I jump off the JavaFX bandwagon immediately as well as a lot of other developer's I know.
Come on, none of the competitors (Flex, Silverlight,Android,Html5) requires to buy runtime licenses.
1. Oracle should remove the license restrictions on deployment.
2. Oracle should open-source,at least,parts of JavaFX.
3. Let's hope to have some clarifications from Oracle soon.

jdevp2 said...

Very well said. As you said, I have much easier time learning ActionScript than JavaFX Script. JavaFX is not Java but another script language running inside JVM. It's a Swing killer in the sense that it takes too much resource from Swing and other parts of Java development.

Jean Lazarou said...

Why inventing a new language? Why not use JRuby, like http://jroller.com/jeanlazarou/entry/sweb_and_styles_part_1

Sure, one person working during his free-time cannot do as much as a company...

Linuxhippy said...

I still wonder what would have happend if Sun would have invested all the development resources into enhancing Swing and the Java platform itself, instead of doing JavaFX.

jdevp2 said...

Linuxhippy@ If Sun had invested all the development resources into enhancing Swing and the Java platform itself, We would have seen Java everywhere on the web just like Flash. Java is definitely faster than ActionScript once JVM is loaded. We have seen a lot of well performed Java applets on the web once the JVM is loaded. If Sun had made a smaller and fast loaded runtime like Flash runtime and if Sun had thought about opening a Java Store a long time ago, we would definitely have seen a lot Java applets on the web for sure.

Writing Java is not much more difficult than writing ActionScript. I don’t see how JavaFX makes life easier with its strange syntax. It took a long time for Swing to evolve to what it is today. How long will it take for JavaFX to be productive ? The latest Android supports Adobe Air/Flash and there is rumor that Silverlight might be on IPhone. Where is Java on all this ? Where is Java Store after one year of its announcement ?

Dustin said...

Thanks all for some outstanding and thought-provoking comments. I appreciate you taking the time to add your own experiences with JavaFX and opinions regarding JavaFX's future.

There are more comments on this post available on the JavaWorld-syndicated version of this post at http://www.javaworld.com/community/node/4382 and at the DZone link to this post.

Dustin said...

The reddit thread responding to the question JavaFX is proprietary, Oracle Java not shippable with Linux ... How will this work out? provides insight into what developers think regarding JavaFX's proprietary nature, its not being included with Linux, and the effect this might have on adoption of potential clients.

Dustin said...

It was a big week at JavaOne 2011 for JavaFX. Oracle announced at JavaOne 2010 one year ago that JavaFX Script was deprecated and that JavaFX would support standard Java APIs. At this year's JavaOne 2011, Oracle announced intentions to seek JCP approval for JavaFX to be part of Java SE and would plan to open source JavaFX.

Dustin said...

Intentions to create an OpenJFX Project have been announced.