Java News from Wednesday, May 9, 2007

Yesterday thoroughly sated me on content free keynotes, so I skipped Oracle's keynote this morning. I hope they didn't actually say anything interesting. Instead I went to Dolores Park to look for Yellow-chevroned Parakeets, and I found them:

Yellow-chevroned Parakeet

Also present were Hooded Orioles, House Finches, Lesser Goldfinches, American Crow, Common Raven, Bushtits, Western Gull, Brewer's Blackbird, Anna's Hummingbird, European Starling, House Sparrow, and Rock Pigeon. I'm wondering if I can manage to make a quick trip to Mount Davidson tomorrow morning and get back before 9:30, or if that's too ambitious.

In any case, the rest of Wednesday is full of technical sessions, so it should be more interesting. Yesterday didn't really pick up till the afternoon. Today should be better.

In the first session, Joe Winchester of IBM is talking about User Interfaces Past Present and Future, Good, bad, and Ugly. GUI metaphor hasn't changed since the Xerox Parc paper-based metaphor. (I don't buy that. Today's interfaces are very different than Parc. ) Winchester says "90% of all computer failures are user error." (This is false. Bad user interfaces cause errors. The fault is in the software, not the user.) Bad user interfaces limit performance of entire system.

Often we can distract the user from the problem. e.g. Mirrors on elevator doors to distract users from how long they're waiting. Windows XP pretends to be ready before it is.

"Choices either force the brain to context switch and lose focus or become relegated to unconscious responses through repetition." This is why you're more likely to have an accident within three miles of your house. That's where you drive unconsciously without paying attention. (Is that really true? Or is it just that a disproportionate percentage of miles driven are within in three miles of our houses?)

He believes exceptions are a problem with the Java language because they aren't handled (empty catch blocks and the like). I'm not sure how he would suggest handling errors then. Java exceptions are better than every alternative I've seen. Simply asserting that there should be no more unexpected, unpredicted errors is not going to cut it.

He thinks video games are better designed because people who make video games love to play video games. I'm not sure. Seems to me this is more darwinian. No one plays or puts up with or remembers bad video games.

Some of the problems with exceptions are showing developer level errors to end users.

Winchester is the best speaker I've seen yet at this show, and the talk is both informative and interesting. Everyone at the conference should have heard it; but IBM probably didn't want to pay the bribe to get a full keynote (and if they had, they wouldn't have wasted their time slot on something useful like this. They would have pitched their latest philosophy instead.) This talk should have been the keynote.

Joshua Block delivered Effective Java Reloaded to a packed house. About half covered generics; half covered other topics. He explained and recommended static factories (old news) and the Builder pattern (new news). I never paid much attention to the Builder pattern before, but he explained it well and made a good case for it in certain circumstances.

I didn't follow all of the generics recommendation, and fully explaining them would require a book (which Bloch promises will be out by JavaOne 2008). However here are some quick summaries:

  1. Avoid raw types in new code.
  2. Don't ignore compiler warnings.
  3. Use Bounded wildcards to increase the applicability of APIs.
  4. Don't confuse bounded wildcards with bounded type variables.
  5. Generics and arrays don't mix. Prefer generics.
  6. Cool Pattern: Typesafe Heterogeneous Container (THC)

Bloch recommended always using the @Override annotation when overriding a method. That's reasonable, but only if you're willing to lock your code into Java 5 or later. I'm not.

His final recommendation was that final is the new private. Mark all fields final by default (blank final is OK) and only remove final if you an demonstrate a need too. This encourages safety and immutability.

One thing I noticed for the first time at this show: a number of people are not only recording but video taping the sessions they attend with both handheld videocameras and digicams in movie mode. I wonder if any unauthorized copies are going to show up on YouTube.

For the first afternoon session, Bruce Johnson and Joel Webber discuss the Google Web Toolkit. I first encountered this in New York a couple of weeks ago and it looked cool: writing AJAX apps in Java that is compiled to DHTML and JavaScript. This is the only session room I've been in so far where I could connect to the wireless network. They have invented image bundles to avoid frequent round trips to retrieve individual images. This speeds up load time quite a bit. Googlebot hates AJAX based sites, (use NOSCRIPT) but Google is working on that.

The lines are getting ridiculous. Two of the rooms I saw have lines out the building and onto the street. The Apache Harmony session has a huge mob packing the upper level of Moscone South waiting to get in. You can barely walk through right now. Still the crowd control works better than I'd expect. That sounds interesting, but instead I decided to watch Romain Guy, Chris Campbell, and Shannon Hickey do an "Extreme GUI Makeover".

A lot more is possible with Swing than I thought.

For the next afternoon session, I returned to the same room where Chris Oliver was talking about JavaScript FX. The session wasn't as packed as I expected, but it's being offered twice and in the catalog it was named F3 so maybe not everyone realized what it was. Overall the session provided a lot of good technical detail that was missing in the keynotes.

The issue is this: why is it faster to develop web apps in Flash than Java? The graphic designers use Photoshop. Swing is a set of nested grey boxes. Java2D can do anything Flash/Photoshop can do but swing can't. However the Java 2D API does not have compositional behavior. JFX includes "SVG-like" declarative interfaces to the Java 2D API as first class components that can be composed together into higher level components.

Data binding elements eliminate many listener classes.

Layout is handled via a Swing GroupLayout. There's a declarative interface to this.

SVG is not used because behavior in SVG is imperative and based on javaScript and DOM. behavior in JFX is declarative. There is an SVG to JFX converter available.

Eventually there will be a compiler that generates byte code but for now it's interpreted.

This is all very early. Much work remains to be done.