Adam Bien's Weblog

Monday Feb 23, 2009

Java FX (Script) And Why It Is Intriguing - Especially For Java Developers, Not Only Designers

  1. Java FX Script is consistent - everything is an expression. Knowing that helps a lot.
  2. Additional access modifiers (script-only, public-read, public-init) allow leaner approaches for building, not only visual, components.
  3. The „skeleton“ of a Java FX application is the scene graph. It is a tree structure starting with stage, scene and has nodes as leafs. It  represents a platform independent model of any visual application. You could actually map this „meta-tree“ to any technology you want. I believe this exactly happens in the desktop and mobile profiles (requires further investigation :-)).
  4. There is no additional ceremony required to call Java objects - its straight forward. Existing Java code can be easily reused.
  5. RESTful (JSON/XML) communication is supported out-of-the-box.
  6. The „bind“ operator enables building of lean Model View Presenter (Passive View / Supervising Controller) applications with clean seperation of concerns. Modification of variables and even functions are tracked directly, without implementing PropertyChangeListeners etc.
  7. Triggers killed getters and setters. You can expose attributes directly and intercept the calls when needed.
  8. Java FX Script is perfect suitable for building casual and not only „flashy“ applications. The majority of Swing components is already exposed to Java FX script.
  9. Domain specific extensions like the duration datatype or frame-based animation framework makes the development of animations easier.
  10. Java FX Script integrates very well with applets and webstart. It is a natural extension of Java-based RIAs. The idea of dragging an applet out of the browser and install it as an application is simple, but really good :-).


Special Events: Java 8 with Java EE 7: "More Power with Less Code", 13th October, 2014 and Java EE 7: "Testing and Code Quality", 14th October, 2014

A book about rethinking Java EE Patterns

Comments:

I started learning JavaFX about a month ago.

In that time, I have learned more Java than I ever learned in the 3 years before.

OK, the Java I had learned before made it easier to learn JavaFX but still.....

Think Sun have a potential winner with this one.

Posted by Maya Incaand on February 23, 2009 at 01:38 PM CET #

> Think Sun have a potential winner with this one.

Sun? Not IBM, Oracle, Redhead, SAP?

Oh wait a moment.... IBM, Oracle and SAP are already moving to Flex. Just like Eclipse-foundation. There's a Java-to-Actionscript compiler available for the last release.

JavaFX is a proprietary technology from Sun. There is no JSR and there will never be a JSR. There is no FOSS-licence and there will... oh wait... nobody really cares. Especially Sun's "Partners" in the Java-community. Did you ever hear one single word about JavaFX from outside Sun?

Sun has no more partners. They all left. Bye bye ...

Posted by Simplicius Simplicissimus on February 23, 2009 at 06:52 PM CET #

> Did you ever hear one single word about JavaFX from outside Sun?

At least Adam is writing about it and it seems he had a deeper look at it, although he's more of a web guy than a desktop or mobile guy (you don't mind, adam?).

And this is the point, I think. Most Java developers are not interested in Flex that much. But with JavaFX it could be different, so that the adoption of Java developers could be much higher.

But anyway, in the end it's best to choose the right tool for the particular application.

Posted by Nick on February 23, 2009 at 08:38 PM CET #

Sorry for posting anonymously but I can't criticize FX openly...

I actually had to work with it and cursed it the whole time.

1. Java FX Script is inconsistent its a weird mix of declarative and imperative script. Of functional programming and object oriented.
E.g. you want to expose a scene in one file to another... What is a "scene" its nothing that you can import or use.
There are just too much constructs and concepts for a person to actually structure an application.

2. I think these are mostly pointless and just added noise. Its amusing that a language that is a regression back to the functional programming days chose to add a more elaborate encapsulation system.

3. "I believe this exactly happens in the desktop and mobile profiles" -
Your faith is great... Problem is that faith != reality.
The scene graph essentially broke interaction with Swing so FX essentially caused Sun to de-emphasize the one thing it was doing well on the client... In mobile FX has two flavors that don't really run on any phone (try it with something more elaborate than just moving a few PNG's around).

4. Try inheriting objects or using them in slightly more elaborate ways. E.g. if your object has say an "init()" method... Which is a reserved word in FX...
Interaction with Java is also made awkward by the "odd" syntax for string concatenation, casting etc...
Don't get me started on mixing an untyped language with a strict language like Java...

6. The "bind" operator is great, when it works which is the very simple use case. When it doesn't you are pretty much screwed. The rules of engagement are "odd" and some exceptions occur in the internal FX implementation which you can't really figure out and trace to a specific bind you did (often you just get stuck for some reason).
Performance is so slow this is unusable in some cases and overusing this is easy since this is so ingrained into everything.
But this is actually a feature I generally like...

8. Swing was killed off by Java FX, very few Swing developers are working on Swing itself. Bugs with the Aero/GTK PLAF's make it practically unusable now.
FX and Swing integration is pretty problematic due to some serious conceptual differences.

9. When I need to build a bouncing ball animation I will be sure to use JavaFX... When I need to build an application with complex features I need something more.
I would also like animations to be generated by the graphics artist which is something JavaFX can't do.

10. The current quality of the deployment in Java 6u10+ is sub par.

Besides all of the above the designer tools for FX are shocking!
Show them to any real designer and explain the process and you would get a "you have to be joking". No animations even?
Exporting doesn't work as expected producing many differences...

Posted by No on February 23, 2009 at 10:48 PM CET #

@Simplicius (btw. - interesting name :-))

>Sun? Not IBM, Oracle, Redhead, SAP?

I guess Sun will be able to monetize FX with licenses. This could pay off. I don't think the others are able to do so.

>Oh wait a moment.... IBM, Oracle and SAP are already moving to Flex. Just like Eclipse-foundation. There's a Java-to-Actionscript compiler available for the last release.

And Microsoft is using Silverlight, Novell Moonlight. There is another great RIA technology called: curl. Flex is very interesting as well, but it is not Java at the end. Just knowing, that Java runs behind the scenes minimizes the risks und allows the "Java" approaches to profile, debug and monitor your application.

>JavaFX is a proprietary technology from Sun.

And Flex / Flash are opensource? The Java FX compiler is open...

>There is no JSR and there will never be a JSR.
Why not? I'm not sure at this point. You know any other RIA related JSR? Frankly it is better to develop a technology quickly with few experts in the first cycles and then open it.

>There is no FOSS-licence and there will... oh wait... nobody really cares. Especially Sun's "Partners" in the Java-community. Did you ever hear one single word about JavaFX from outside Sun?

I'm very outside Sun :-)

>Sun has no more partners. They all left. Bye bye ...

No idea how many partners Sun has. But I cannot imagine, that some one will leave Sun, just because of Java FX...

Posted by Adam Bien on February 24, 2009 at 09:05 AM CET #

If Sun produced an open source, cross platform alternative to Flash I would be very interested. At the moment, JavaFX is neither. While Linux support is supposedly on its way, JavaFX is unlikely to become truly open source because it incorporates a patented video codec (VP6).

Remind me why I should use JavaFX rather than Flash...

Posted by Pete Chown on February 24, 2009 at 11:30 AM CET #

Javafx needs decent GUI tools such like the flexbuilder for the flex environment. Drag and drop interface design not hand coding everything is an essential for serious adoption

Posted by Neil Murphy on February 24, 2009 at 11:34 AM CET #

Pete,

Java wasn't opensource the first 10 years - but it was still interesting :-).
You should use JavaFX rather than, Flash - not so sure about the comparison with Flex :-).

thanks for your comment,

adam

Posted by Adam Bien on February 24, 2009 at 02:00 PM CET #

@Neil,

>Javafx needs decent GUI tools such like the flexbuilder for the flex environment. Drag and drop interface design not hand coding everything is an essential for serious adoption.

Absolutely, but keep in mind, that Java FX is very young. It was released in December 2008...

thanks,

adam

Posted by Adam Bien on February 24, 2009 at 02:06 PM CET #

The biggest problem I see with JavaFX is loading time. I have whined about this other places, but I will say it here to. Users do not want or need to wait for RIAs to load, at least on fast machines. JavaFX though loads slowly. This isn't a problem with Java; go look at the scenegraph demos on java.net. Very fast loading times. I really can't see JavaFX becoming a competitor when other solutions exist that load faster.

Posted by Vance on February 24, 2009 at 03:11 PM CET #

@Vance,

Java FX script is a compiled language, so I don't think it is a inherent problem. Again: keep in mind that it is very young technology,

thanks && regards,

adam

Posted by Adam Bien on February 24, 2009 at 05:42 PM CET #

That is what I am hoping for. Sun has increased Java execution speed greatly in the past few years, and I hope they will decrease start-up time.

Posted by Vance on February 25, 2009 at 04:20 AM CET #

Post a Comment:
  • HTML Syntax: NOT allowed
realworldpatterns.com
...the last 150 posts
...the last 10 comments
Links
License