Monday, October 3, 2011

JavaOne 2011: Moving to the Client - JavaFX and HTML5

Stephen Chin (Chief Agile Methodologist at GXS) and Kevin Nilson (Just Me VP of Engineering) presented "Moving to the Client - JavaFX and HTML5" (22122) in Nikko Ballroom in Hotel Nikko on mid-afternoon Monday of JavaOne 2011. This was another well-attended session in a relatively large room, which is not too surprising when its title contains one of the most popular topics in recent JavaOne conferences (JavaFX) and one of the trendiest topics in all of software development (HTML5).

After both speakers introduced themselves, Kevin Nilson went into the "History of the Web" and the road to HTML5. He showed a slide with "Tableless Web Design" in 2002, Ajax in 2005, and HTML5 in 2009. Nilson contrasted Web Hypertext Application Technology Working Group (WHATWG) with Java's Java Community Process (JCP).

Nilson said that HTML5 is not simply HTML + CSS + JavaScript. He instead calls HTML5 the "next generation features for modern web development." He also outlined some specific HTML features such as web storage, HTML5 Geolocation API, and so forth.

Nilson dove deeper into HTML5 examples by starting with rounded corners. Images are no longer necessary to present rounded corners. Nilson then moved onto WebGL (OpenGL in the web browser), which is an extension of HTML5's canvas.

Nilson talked about "Prefixes" which are useful "before the spec is final" and "before the browser implementation is verified." Nilson talked about one of my pet peeves of HTML and related technologies: lack of standardization in implementation. Nilson pointed out that we've had to use JavaScript frameworks such as jQuery, Dojo, and YUI to have a consistent API. The hope is that HTML5 will bring standardization without frameworks. Nilson talked about the Acid Test which states how many requirements out of 100 a particular browser satisfies.

Nilson showed a snippet of code using JQuery which is available at http://jsfiddle.net/3urR9/. The jsFiddle tool that Nilson used to demonstrate this is an interesting tool for playing with JavaScript in an online environment. Nilson also introduced Chrome Frame for running Chrome within IE6, IE7, and IE8. It is designed so that administrative privileges are not required to install it. Nilson also referenced Modernizr, a tool I discussed in my post Modernizr: A Handy HTML5 Tool.

Stephen Chin spoke about JavaFX 2.0 GA being released today. Because JavaFX now uses Java rather than its own scripting language, the dominant Java IDEs support JavaFX. Similarly, Java developers can "leverage [their] Java skills with modern JavaFX APIs." Nilson added commentary on an iPhone app he wrote called Indalo. Nilson talked about Titanium which allows writing of application in JavaScript that is converted to iPhone or Android for runtime. Nilson also referenced Adobe's purchase of Nitobi and their PhoneGap, which is similar to Titanium.

Chin introduced WebView for embedding web content within JavaFX. He also spoke about the ability to use JavaFX with other JVM languages such as Groovy and Scala. Chin and Nilson made the important point that JavaFX can call the browser, but the browser cannot call JavaFX. Although JavaScript cannot call back to JavaFX code directly, you can "hack" a work-around to use status to communicate back from JavaScript to JavaFX.

I have had trouble with the Wifi for most of the conference so far. I thought it might just be me, but I heard other attendees talking about problems and it was definitely an issue in this presentation as both Nilson and Chin had examples that relied on web connectivity, of which they had none. All of this confirms the wisdom in reactivating and bringing my Verizon Prepaid Wireless Broadband to the conference. It was also nice to have my Droid on hand for getting around the city and for web connectivity. Chin used NetBeans IDE 7.1 beta for showing JavaFX code and he stated that he also used today's released JavaFX 2.0 GA.

The slides of a previous version of this presentation are available on SlideShare.