JavaFX Is Many Times Faster And Easier Than Swing

jim-weaver[1]Jim Weaver, one of the best known names in the JavaFX world talks to IndicThreads about JavaFX Script, where it stands today, how it compares to other RIA technologies and where JavaFX looks headed. Jim gives us an overview of the development cycle for a JavaFX Script application. He also talks about the benefits of using JavaFX and the challenges faced in its
adoption.

Harshad Oak >> Hi Jim. Welcome to this interview with IndicThreads. Could you introduce yourself?

Jim Weaver >> Hello Harshad. Thanks for this opportunity. I’m Jim Weaver, known most recently as a JavaFX Script author, speaker and blogger. I’ve been developing Java applications since 1995, and during that time have co-authored a few books on Java and J2EE.

Harshad Oak >> Let’s look at the questions that first come to mind when one thinks of JavaFX 1) Why another language? 2) Where do I place JavaFX; is it a new language / a framework / a toolkit… ?

Jim Weaver >> Why another language? I like the way that Josh Marinacci of Sun put it in a recent Java Posse interview: JavaFX is sort of a code word for reinventing client Java and fixing the sins of the past. Both Java Swing and Java 2D have lots of capability, but are also very complex. You can use a GUI developer tool that generates code, but I’m never satisfied with that code. JavaFX Script allows you to simply and elegantly express a UI, including cross-platform layout components, with a declarative programming style. It also leverages the full power of Java, because you can instantiate and use the millions of Java classes that exist today directly from JavaFX Script. Add features like binding the UI to attributes in a model, and triggers that obviate the need for setter methods, and you have a language that is an order of magnitude faster and easier to use than traditional client Java.

“Java Swing and Java 2D have lots of capability, but are also very complex….”

Regarding where to place  JavaFX: It is a family of products that includes JavaFX Mobile (a complete software stack for mobile devices) and  JavaFX Script. JavaFX Script is a declarative programming language that is fully object-oriented and statically typed. See the http://javafxpert.com/weblog/2008/01/want-to-learn-c.html post in my Helping you become a JavaFXpert weblog for some example code. I’m also writing for Sun a series entitled Creating Rich Internet Applications with Compiled JavaFX Script Technology.

“JavaFX is an order of magnitude faster and easier to use than traditional client Java….”

Harshad Oak >> Could you give us a high level overview of the steps involved in developing and deploying a bare bones JavaFX Script application and a JavaFX Mobile application?

Jim Weaver >> First I need to say that there are two versions of JavaFX Script in use today: The interpreted version, which is essentially a prototype, and the real version, which is compiled into JVM bytecode. The interpreted version has IDE plug-in support, so the development cycle can be very IDE-centric. I’ve been encouraging developers to move to compiled JavaFX Script because it’s getting pretty solid, however IDE support isn’t quite there yet. The development cycle that I use for compiled JavaFX Script is:

  • Declaratively express the UI, while designing the classes that represent the model behind the UI, binding the UI to the model as appropriate. All source code is in files with an FX extension.
  • Use the javafxc command-line tool to compile the FX source code.
  • Use the javafx tool (appletviewer in the case of applets) to run the program. By the way, see the link to the article I mentioned a bit ago to learn how to obtain the JavaFX Script compiler, and use the javafxc and javafx tools.
  • To deploy the program, make it available via Java Web Start (JNLP), or via a browser.

“JavaFX Script Development Cycle…”

Harshad Oak >> On the client side, Adobe seems to have a major advantage because a large majority of web users already have Flash players installed. How about JavaFX? What’s required on the client and what percentage already have it installed?

Jim Weaver >> Java Runtime Environment (JRE) 1.5 or later is required on the client. Making this happen has been a big problem in achieving the dream of rich client Java. Much progress has already been made in this regard, and I am confident that the Java SE 6 Update N (J6uN) project will play a big part in solving this problem as well as other deployment speed issues.

“Making the JRE available on the client has been a big problem in achieving the dream of rich client Java…”

I anticipate that by the end of 2008 the required version of the JRE, as well as the features that make JavaFX Script applications deploy quickly, will be nearly ubiquitous. Of course, my predictions and 5 USD will get you a Café Latte.

“By end of 2008, the required JRE & features for JavaFX Script will be nearly ubiquitous”

Harshad Oak >> Swing and Swing based frameworks have tried valiantly for years to get Java on the client side. Why would JavaFX succeed where Swing has failed?

Jim Weaver >> The ease of developing applications in JavaFX Script, including its ability to allow graphic designers and programmers to collaborate, coupled with the J6uN project, will supply the necessary motivation and momentum.

Javafx ScriptHarshad Oak >> Java today enjoys great tools support. So even if we presume that a new language like JavaFX is far simpler than Java, it is likely that it will still take far less time to develop using Java because of the great tools, editors and GUIs available for Java development. When does one look at a JavaFX solution?

Jim Weaver >> Because of its simplicity, I find that developing JavaFX Script without an IDE is just as easy as developing Java programs with an IDE. As I mentioned earlier, IDE plug-ins are coming for compiled JavaFX Script. In addition, there are tools coming for JavaFX Script that will be geared toward enabling a graphic designer to collaborate with a programmer in creating stunning JavaFX Script applications.

“Developing JavaFX Script without an IDE is as easy as developing Java programs with an IDE…”

Harshad Oak >> Can JavaFX generate HTML+JavaScript based web applications or is it always a Swing kind of application that will work in the browser?

Jim Weaver >> I’d really like to get away from equating web applications with internet applications. Let’s let JavaFX Script enable rich-client internet applications, and let HTML do what it was created to do (share rich media content). JavaScript evolved to its current state because we couldn’t make the JRE ubiquitous on the client. Once this finally happens, we can let each technology do what it is intended to do, and get away from the hard to maintain web applications that we have today.

“I’d really like to get away from equating web applications with internet applications…

Harshad Oak >> Most RIA solutions have been found to be search engine and bookmarking unfriendly. Has JavaFX Script found a way around the problem?

Jim Weaver >> I haven’t given much thought to this. Please let me make a note of this and respond later.

Harshad Oak >> Developers have been grumbling for the past few years that to stay cutting edge they have had to learn not just new tools or frameworks but entirely new languages every few months. With JavaFX, it looks like there’s even more to learn than just a new language. How steep is the learning curve?

Jim Weaver >> The learning curve is comparable to learning any new programming language. It’s also fun and well worth it!

Harshad Oak >> Have you evaluated any other scripting languages? Any thoughts on how JavaFX compares with them?

Jim Weaver >> I’ve been very focused on JavaFX Script since July 2007, so I’m not the best person to answer this question.

Harshad Oak >> JavaFX on its launch at JavaOne 2007 had received a luke warm response at best. Do you believe things have picked up since? Any predictions for JavaFX in 08 and 09?

Jim Weaver >> JavaFX Script has come a long way since JavaOne 2007. We’ll see some very impressive things at JavaOne 2008. By the way I’m doing a three hour JavaFX Script University Session at JavaOne with Sang Shin this year, as well as a Conference session on JavaFX Script. My predictions for JavaFX Script in 08 and 09 are that it will gradually become a preferred alternative to developing traditional web applications.

“JavaFX Script will gradually become a preferred alternative to developing traditional web applications….”

Harshad Oak >> Thanks Jim. It’s been wonderful talking to you and learning about JavaFX.

Jim Weaver >> My pleasure, Harshad !

RELATED :
* Python, C# & Flash are hot – Java, Ruby & Ajax are not
* The IndicThreads Software Technology & Emerging Trends Conversation 2008
* Groovy bridges the scripting and the enterprise Java worlds
* Groovy and Grails – A Getting Started Guide

Content Team

The IndicThreads Content Team posts news about the latest and greatest in software development as well as content from IndicThreads' conferences and events. Track us social media @IndicThreads. Stay tuned!

0 thoughts on “JavaFX Is Many Times Faster And Easier Than Swing

Leave a Reply