JavaOne 2008 Day Two

08 May, 2008
Xebia Background Header Wave

Today was the second day of the JavaOne 2008. Besides doing a lot of chatting in the JavaOne pavillion, and visiting all the cool parties this night, we also went to a number of sessions. Also today the NLJug had the James Gosling meeting we won for being the biggest JUG out here. After a long day of work, we finally had time to relax at the Adobe party and at the SDN party.
Todays topics included:

  • Closures
  • JavaFx, Groovy and Google Android
  • Swing GUI testing
  • Scripting

Mischa on part of his day @JavaOne
Closures Cookbook
Neal Gafter showed in his presentation a bunch of examples that should simplify coding and minimize use of boilerplate code using the "BGGA closure" proposal.
There are a few examples in which I would love to use closures for example like:
Adding a listener to a swing component.

ItemSelectable = ...;
is.addItemListener( { ItemEvent e => doSomething(e,is); });

or Aggregate Operations like ie. getting the highest Gpa from a list of Students.

final double highestGpa =
  .filter({ Student s => s.graduationYear==THIS_YEAR })
  .map({ Student s => s.getGpa() })

Though the impact of the BGGA closure proposal seems to be massive and the usage could result in very complex code, especially when combining closures with generics.

void for eachEntry(Map m, { K, V ==> void throws X } block) {
    for (Map.Entry e : m.entrySet()) {
        block.invoke(e.getKey(), e.getValue());

All considered, it will result in cleaner code. But I am not convinced yet.
Going Mobile with JavaFx Script Technology, Groovy, and Google Android
Mike Mannion and Dierk König of Canoo shared there experiences on the JavaFx, Groovy and Google android.
Their experiences with the development of JavaFx were both negative and positive. Negative points were mainly about the development tools and the different syntax compared to Java.
On the other hand due to the declarative approach, the learning curve is quite low and productivity high.
Their experiences with Google android are quite positive. It has no real GUI restrictions, includes a lot of standard functionality and can be easily extended with Java libraries. The only
downside they found was the xml based GUI layout. Though the learning curve is quite steap.
Swing GUI testing made Easy
Testing GUIs can be difficult. This is due to a couple of things:

  • Test should be automated, but GUIs are designed for humans
  • Guis are usually composed of more then one class
  • The number GUI interactions can be huge
  • Conventional test coverage is not enough to cover all user interaction scenarios.

For testing Swing GUIs you have to meet a couple of requirements:

  • The ability to simulate user input
  • The need to have a reliable mechanism for finding GUI components..
  • The ability to tolerate changes in position, size, layout etc..

Fest is an open source library that gives you these abilities. It has a good API, supports component lookup by name and type, integrates with JUnit and TestNG.
What is really nice is that Fest can automatically embed a screenshot of the desktop so you can see what the GUI looked like when the test failed.
Erik Jan on Web Beans
Web Beans is a framework that Gavin King wrote to be able to bind all kinds of java objects together. It came out of Seam but developed further there is a JSR for it. Oracle also has a similar solution for it.
Web Beans aims to be able to use ‘loose coupling with strong typing’. To be able to do this it has to use anotations in a special way. A simple example of a Webbean:

class Hello {
   public String hello(String name) {
      return “hello “ + name;

A simple client

class Printer {
   @Current Hello hello;
   public void hello() {
      System.out.println( hello.hello(“world”) );

The Web Beans container will now look for a component that is a Hello object and inject it it can also use constructor injection or an initializer injection with a parameter. But what if we have two implementations of the same interface, for instance one for testing and one for production. For this particular case Web Beans will have the ability to specify deployment types, this is done in a xml document.
It will also contain a way to add scope to beans and he created an extension on the EJB 3 listeners and a lot more. There will even be Spring support when it’s done… so take a look at his blog to find out what the status is…
Jeroen on Scripting
I had the privilege today of being in the close presence of some of the scripting gurus of the JVM. Today the scripting language shootout, the "Script Bowl" was being held. The format was an American Idol style format consisting of 3 rounds, the competitors were:

  • Guillaume LaForge (Grails)
  • Charles Nutter (JRuby)
  • Frank Wierzbecki (Jython)
  • Jorge Ortiz (Scala)

In the first round all the script gurus had to show a Twitter client in the scripting language of their choice and browse through the code. The richest clients were written in Groovy and JRuby, however Charles admittedly did not write his client himself. Jython and JRuby fell behind but they had working solutions. The jury, consisting of amongst others Ola Bini, considered Groovy the best, with a JRuby a runner up. The crowd sent the highest marks to JRuby followed by Groovy.
The second assignment was to build a web app based on the sample MySQL database. Guillaume used the Grails framework, whereas Charles presented a Rails application. Frank however didn’t implement all the functionality using Jython, and Jorge failed to implement anything at all and consequently showed us something else in Scala.Here highest marks were agin given to JRuby and Groovy.
The third round was the "Show your coolness" round. Guillaume showed us a HTML page from the JBoss Seam project which contained the documentation for the Seam and Groovy integration. Charles however showed 2 brilliant demos with cool graphical effects! The app he showed was called "A face for Stephen Hawking", Google that if you’re interested. Here Jorge showed us how easy it is to write multithreaded applications using Scala. Using the actor keyword it is easy to spawn off new threads which share no mutable state whatsoever. The end result was that Charles won the shootout with JRuby, but Guillaume was a close second with Groovy.
If you want to follow a more blow by blow report, try following my Twitter stream. You can find me at:
Marco on his day @JavaOne
Oracle keynote
Actually I had planned to skip this one to catch some extra z’s but I just couldn’t bear to leave my companions in the cold by having them walk the dangerous streets of San Francisco all by themselves. We were treated to a nice stage play which reminded me of a tell sell commercial. “Wow Mike, so you say that if I process these orders those cool 3d bars will be updated right away?” Their product seemed cool though, worth taking a closer look at. If only I could remember it’s name ..
Creating a Java Platform, Enterprise Edition (Java EE Platform) Appliance, Using the GlassFish, OpenSolaris and Indiana Projects
Somewhere between naming this session and actually presenting it, the speakers probably decided they didn’t want to run the risk of a lawsuit, as the name ‘Indiana’ wasn’t mentioned even once. A good thing too, ‘coz mr. Jones still knows how to use that whip! This was about running web applications on appliances, using ZFS (a new kind of openSolaris file system) as a means to rollback, so there won’t be any need for hard-to-do reinstallations. A cool idea, but somehow I think I’ve heard it all before. Also, they used GlassFish v2 for this, and kept on saying how unfortunate it was that it wasn’t modular, Ehm, switch to the new version?
Open-Source Service-Oriented Architecture with Service Component Architecture and Apache Tuscany
Presented by somebody who looked a lot like a young Martin Sheen and the follow-up to a session I visited yesterday, this managed to make me even more interested in the topic at hand. For those not in the know: SCA is a development & deployment tool for SOA, based around assembled components called composites, and it may very well become the next big thing in the world of SOA. Or maybe it already is, who can keep track?
It’s all about the SOA: RESTful Service-Oriented Architecture at
Confession time: I had enrolled for an entirely different session (Java Persistence 2.0) but at the last minute decided to jump ship in what may well be the brightest moment I had all week. My reward was a nice story about how one of the biggest online retailers (it says so in the abstract, so it must be true) made the change from dreadful C to the wonderful delight that is Java in a very short period of time. Glad to know that after all that hard work they can finally enjoy some REST now.
Nothing? Wow, tough crowd ..
Creating a Compelling User Experience
As all Dutch will probably agree, SOA is nothing to laugh about, which is why this session served as a welcome relief. By far the most fun I had up until now it also gave me some fresh insight on interaction designers and the delicate relationship they hold with those people that just want things to look pretty. Two thumbs and a big toe up for this one.
JSR 303: From a World of Constraints to Constrain the World
Another non-SOA session, this one took me back to when I used the Struts Validation Framework to model the business logic of a large insurance company, resulting in several huge xml files. Ah, those were the days .. No big surprises here, which kind of disappointed me to be honest. Nice presentation though, even with the heavy French accent.
Some nice sessions, two of those that flew by, one which seemed to last forever (mental note: next time after gulping an entire can of soda go to the toilet first before attending a session). SCA was again the highlight of the day, but the presentation about user experience still gives me chuckles thinking about it. Anyway, halfway there, let’s see what tomorrow will bring.


Get in touch with us to learn more about the subject and related solutions

Explore related posts