The team of guys that worked on the “Music Pinboard” application are all seasoned Java/Swing/2D (and ULC) experts. So although it’s been a while, we do recall that it took us a little while to really learn these APIs in depth, not to mention the various subtleties behind them. We have also coached relative beginners in Java and have, not surprisingly, witnessed the process taking even longer.
So an important question for us to consider was: Is learning Java FX script (JFX) significantly easier than learning Swing?
Admittedly, we can’t be entirely objective when answering this question because – good news – knowing Swing (what components and layout managers are available etc.) gives the developer a significant jump-start. This fact was one of the reasons we were able to construct “Music Pinboard” so quickly.
Nevertheless, there were a number of aspects of JFX, which were novel to us, and which therefore demanded special attention:
- JFX’s declarative constructs
- JFX’s (sometimes unnecessary) deviations from Java syntax
- Provision of animation
- JFX’s threading model
- Discovering how to integrate external components
To assist in the first four of these areas, we found the pages provided by Chris Oliver, which document numerous F3 examples, to be the most useful. (Aside: JFX was called F3 prior to its rebranding for the JavaFX product line.) But we should bear in mind that the provision of WYSIWYG tools for JFX could potentially eliminate most of the learning time here, at the same time reducing the barrier of entry for the non-Java specialist. The company ReportMill has provided an early version of a tool – JFXBuilder – which demonstrates the kind of support, which will be required by such users. We didn’t use JFXBuilder for “Music Pinboard”, but as an aid to learning the tool proved useful on some occasions (construct a GUI using the point-and-click builder, look at generated source code etc.)
Let us then consider three types of developer:
- The non-Java programmer, with no interest in becoming a Java expert, perhaps with a background in web authoring and/or UI design
- The Java programmer, with no Swing (or similar) experience
- The hardcore Swing developer
Firstly, a non-Java developer will certainly require the a good WYSIWYG tool before s/he can become truly productive with JFX. Although, as mentioned above, at least one early solution is available today, anyone coming from an Adobe/Flash background will likely find the lack of industrial strength tools for JFX reason enough to reject the technology.
For the Java programmer with no prior Swing experience the situation is different. If the requirements are to produce a non-trivial GUI, then this developer will quite likely get off the ground quicker with JFX than with Swing, because s/he will have to learn about widgets and layout managers in either case, and because it is simply easier to construct GUIs using JFX’s declarative syntax than with Swing. Learning time? We estimate for Swing from 2-5 weeks; for JFX 1-3. The reality will, of course, vary significantly depending on the person involved and the environment in which s/he works.
For obvious reasons, the “seriously hardcore” Swing developer is less likely to profit from the simplifications provided by JFX than his non-Swingy counterpart. JFX is, after all, a new language, which deviates from the Java programming model in significant ways. This type of developer will likely complain about the inconsistencies and seemingly unnecessary deviations from Java syntax, which hinder his or her learning, and may consider joining the OpenJFX project in the hope of having some influence. On the other hand, if the next GUI development is calling for extensive Java2D effects and animation, then even this type of developer will likely experience a productivity boost using JFX, and may therefore find the 2-3 days (our estimate based on the “Music Pinboard” experience) of learning time a worthwhile investment.
Finally, if choosing a language like JFX as opposed to Java Swing or Groovy is a strategic i.e. long-term decision for your organization, then the initial learning curve will not prove that significant. What is important here is the potential improvement in productivity once the learning stage is over (we will address this in JavaFX Script Productivity Part II of II: Developing), as well as many other technical factors, which we will consider in future blog entries.
To conclude, ease of learning definitely impacts the overall attractiveness of a language or platform, and was one of the reasons for Java’s success as an alternative to C++. Sun and the wider JFX community will have to improve its current level of Java-syntax and WYSIWYG tool support for JFX, if it is to find acceptance with programmer and non-programmer alike.