Flex and JavaFX

An Interview with Adobe's James Ward from JavaOne 2007

by Frank Sommers and Bill Venners
June 6, 2007

Summary
When Sun announced JavaFX, its latest take on client-side Java, some developers noted that key features of JavaFX, such as its declarative programming style, were already present in other client-side frameworks, such as Flex. In this interview with Artima, James Ward, Adobe's Flex and Apollo evangelist, shares Adobe's response to JavaFX, and highlights some similarities and differences between Flex and JavaFX.

The ability to quickly and effectively create rich user interfaces is becoming increasingly important to developers. Choosing the right tool for the job, however, is made harder by the ever-increasing choices in rich-client tools and APIs. When Sun announced JavaFX at this year's JavaOne, few developers thought that rich-client Java would compete with, or even replace, other rich-client UI technologies. Indeed, Ajax frameworks, JSF libraries, Flex, Swing, and lately Microsoft's Silverlight, often complement one another in ways not immediately obvious from brief news announcements and project descriptions.

Flex has become a more attractive UI toolkit since Adobe announced the open-source release under a Mozilla license of the forthcoming major Flex SDK. Following Sun's announcement of JavaFX, Artima asked James Ward, Adobe's Flex and Apollo evangelist, about Adobe's reaction to JavaFX, and about differences and similarities between JavaFX and Flex (for a more in-depth interview on Flex with James Ward, see ActionScript 3: The Language of Flex and The Flex Programming Model):

[With JavaFX, Sun is] validating that using a declarative language to build GUI applications, and then have another language underneath that you can do more with, is the right idea. It also validates our approach of using the same programming model for desktop and Web applications. It also shows that we've done something right with our deployment model for using Flash that everyone already has...

Of the key differences, Ward had this to say:

One of the main differences is in the deployment model we're using. For Flex applications within the browser, we use the Flash platform. Everyone has Flash, and we are able to use that as our virtual machine for Flex applications... Java doesn't have that consistent platform on the Web that they can build on. We're able to still use Java on the back-end, but use Flex and Flash on the front end. With Apollo coming up as well, we're able to have that work in the same way for desktop applications...

MXML is an XML language to create Flex applications. F3 is a predecessor to JavaFX [that] Chris Oliver created to make it easier to [build] Swing applications. We use XML as our notation, and JavaFX uses a JSON-like notation. We chose XML because it's familiar to Web application developers. It's familiar to people doing HTML development... We wanted to be able to take Web developers' skills, and allow them to build Flex applications.

Ward also noted that some differences between Flex and JavaFX stem from the different underlying languages used by these tools:

We also have a procedural language. We use ActionScript, which is an implementation of ECMAScript, the JavaScript standard...

We've been trying for a long time to get properties and events to be integrated into the Java language, specifically to allow us to more easily use an [API] like Swing. Without properties and events, any time you want to have a custom event handler, you have to extend, [say], the Button class and create your own implementation. If events are baked into the language, like they are in Flex, then it becomes much easier to handle events and catch events in your application, and deal with user input, and other things that are typical in a GUI application. Properties and events are very important. There is a JSR to fix that, but how long will it take before that actually happens?

Finally, some differences are due to differing capabilities of the current Flash and Java VMs on the desktop:

A lot of applications are starting to integrate multimedia now. Not just for video [display], but actually integrating video experiences into the application. That multimedia experience is not as good in Java as it is in Flash... In Flex, there is video and audio support, you can record from cameras. For audio playback, we support MP3 as a primary audio mechanism, [and] you can stream audio and video to Flash applications.

Click to download audio James Ward, a technical evangelist for Flex and Apollo at Adobe, talks about Flex and JavaFX. (8 minutes 13 seconds)

Do you think client-side Java would gain if Adobe and Sun decided to work closely together and turn the Flash virtual machine into a Java virtual machine as well?

Post your opinion in the discussion forum.

Talk back!

Have an opinion? Readers have already posted 6 comments about this article. Why not add yours?

About the authors

Frank Sommers is Editor-in-Chief of Artima Developer. He also serves as chief editor of the IEEE Technical Committee on Scalable Computing's newsletter, and is an elected member of the Jini Community's Technical Advisory Committee. Prior to joining Artima, Frank wrote the Jiniology and Web services columns for JavaWorld.

Bill Venners is president of Artima, Inc. He is author of the book, Inside the Java Virtual Machine, a programmer-oriented survey of the Java platform's architecture and internals. His popular columns in JavaWorld magazine covered Java internals, object-oriented design, and Jini. Bill has been active in the Jini Community since its inception. He led the Jini Community's ServiceUI project, whose ServiceUI API became the de facto standard way to associate user interfaces to Jini services. Bill also serves as an elected member of the Jini Community's initial Technical Oversight Committee (TOC), and in this role helped to define the governance process for the community.