JavaOne 2011 Day 3

It's the third day of Java One. No keynote today, but I write about the thrills of the Script Bowl, alternative languages for Java EE, OpenEJB, and the GreenFoot and BlueJ projects for computer science education which I hope Oracle will continue to fund.

The Script Bowl is another JavaOne tradition. The candidates were JRuby, Groovy, Scala, and Clojure. The JRuby pitch was simple: Use Rails for your web apps, and you are on your way to untold riches. The Groovy pitch was, I kid you not, that you can write fluent interfaces without parentheses, like 

take 2 pills and call me in the morning 

instead of


Dick Wall showed off how to use the Scala REPL to take apart some XML. He also presented Kojo, a Scala environment for teaching math and programming to kids.

We all know that Scala is complex and scary, and Dick had to be a bit careful not to scare the audience with horribly complex Scala code such as

repeat (4) {

When preparing their presentations, one of the other fellows accused Dick of cheating. “That's not Scala”. Umm, actually it is.

The Clojure demo didn't go so well—I am sure it was all great magic, but it was difficult to follow what was happening. The winner was chosen by acclamation. Clearly, the audience loved Scala the best, but the game was rigged. Scala and Groovy were declared the co-winners.

I went to a presentation on ”non-Scala languages for Java EE development”. The presenter started out with some Scala bashing, showing the obligatory block of incomprehensible Scala gobbledygook:

public static <T,U> T[] copyOf(U[] original, int newLength, Class<? extends T[]> newType) {
    T[] copy = ((Object)newType == (Object)Object[].class)
        ? (T[]) new Object[newLength]
        : (T[]) Array.newInstance(newType.getComponentType(), newLength);

Oops, I messed up, that was actually Java, straight from java.util.Arrays. But whatever—every language has its bizarre parts.

The presenter talked about Fantom and Gosu, showing off a lot of syntax and unfortunately very little semantics. In my advanced programming class, I do it the other way around. I carve out the minimum feature set that leads to an unusual and mindbending feature, such as Ruby metaprogramming, and then show off some amazing magic that one can't dream of doing in Java. My students complain that I skip over the first 95% of the user manual and only cover the last 5%. Umm, yes.

I was wondering where the JavaEE angle came in. There are several teensy web frameworks in Fantom. And the Fantom fans started working on an ORM. The speaker noted that it is a problem that one needs to replicate all the usual infrastructure when one comes out with a new language. Umm, yes.

During the scripting shootout, someone asked about web frameworks. Rails. Grails. Lift. Play. But nobody mentioned my favorite enterprise framework for Scala: good old Java EE. I program my managed beans, session beans, entity beans in Scala, and take advantage of shorter and more concise code. Call me lazy.

Talking of lazy, I went to a talk on the Java 7 file system improvements, one of the more underappreciated improvements in Java 7. Now there are one-liners for common tasks.

List<String> lines = Files.readAllLines(path, UTF-8)
Files.copy(source, target)

Thank you!

In the afternoon, I saw a presentation of OpenEJB, Apache's EJB server whose claim to fame is that you can start it up via public static void main. That's really useful for unit testing. I had looked at it three years ago when it wasn't quite ready for prime time, but now it looked pretty nice. Check it out for testing your session and entity beans.

I ran into Michael Kölling and Ian Utting, who are here to secure continued funding for their GreenFoot and  BlueJ projects, excellent programs for teaching Java programming to high school and college students. I use them in my own teaching, for visualizing objects and as stepping stones towards a professional IDE, and can highly recommend them for anyone who teaches Java.

Will Oracle fund them like Sun did? Yolande Poitier, the community outreach manager, was about to tell me, but then she spotted my bright orange press/blogger badge, blanched, and said “I was told that I can't talk to you”.

I very much hope Oracle continues the funding. Particularly on the high school level, computer science education needs all the help it can get, and then some.