Java One 2009 Day 2

Here is my ongoing blog from the floor of Java One. I report on a most painful keynote, a JUG meeting with James Gosling, talks about concurrency, and the controversy around JSR 299 (AKA WebBeans, erm, Contexts and Dependency Injection).

The keynote

I do this to myself every year. I go to the opening keynote on Tuesday. I suffer through the love-in-with-Sun-partners part, just so I can get to the good part with the important announcements. Then I go to the Wednesday keynote, which offers no such benefit, and vow never to go to any other keynote except for James Gosling's toy show.

Today's mobility keynote was easily the most painful in my memory. Some fellow from Sony Ericsson broke into rambling monologes that left his stage partners speechless, and he had an inexhaustible supply of platitudes (such as "Every user is unique" and "You can be a part of the total experience") that work better in the executive suite than a gathering of engineers.

He seemed a bit taken aback that the audience didn't "get" the idea of "monetizing" the 200 million Sony Ericsson phones out there. But help is on the way, in the form of another app store. Oh goody...

The store has been around for some time, selling ring tones, games, music, and movies. Unlike the Java app store, they figured out how to take money. After July 1, you can submit your apps (without having to pay a fee, which is apparently customary in the game biz), and they'll review it within 30 days. For their trouble, there will be a 70/30 "rev share".

I think I'll skip the other keynotes.

JUG Meeting With James Gosling/Buzz from the Floor/Radio Interview

Van Riper kindly invited me to the Silicon Valley JUG meeting with James Gosling. JUG members and students asked lots of very interesting questions. A few random answers that I remember, hopefully accurately:

In hindsight, there aren't many things that should have been changed in Java 14 years ago. The C++ like syntax was necessary for wide adoption, and it was important to get it out then rather than waiting any longer.

Functional programming is great, but a lot of people have a hard time thinking that way.

Those alternatives to locking sound seductive at first, but not many problems map into it in a way that is natural to most programmers.

Google Android pays little attention to keeping a common standard, and there will be nasty surprises when every vendor does their own extensions.

People asked about "buzz from the floor", such as "Why isn't there a banner advertising next year's Java One, like there used to be in the past?" James didn't know. But he did know what was behind the rumor that he coached Larry Ellison in Java FX programming. It was not so. Larry just downloaded the SDK and hacked together some stuff on his own. Later, I told that story to some engineers, and they inquired whether it was really Larry who did it, and not his personal hacker.

Unfortunately, I had to run off early to give a Java One Radio interview. The recording should be available here[2].

Technical Sessions

I attended Jonas Bonér's session entitled "State--You are doing it wrong". Jonas reviewed three alternatives to standard locking: Software transactional memory (with Clojure), actors (with Scala), and data flow, which he called "the forgotten paradigm". He wrote a custom library for data on top of Scala actors. It wasn't very deep, but I learned

In data flow, deadlocks are deterministic. Run your program again, and it deadlocks in the same way.

STM isn't a free lunch--one can spend a lot of time retrying transactions

Alex Miller gave a talk on concurrency gotcha's, with good old fashioned locks. The talk was very well attended--clearly, interest in concurrency has reached the mainstream. Most of the gotchas were pretty familiar, such as the shared DateFormat. (I really hope the date and time API makes it into Java 7. Haven't we suffered enough?) I liked the slide:

synchronized(what goes here?)

I had students who would just try filling in one thing after another into that slot...

I tell students that they should just stay away from synchronized blocks unless they really know what they are doing. Reentrant locks seem easier to understand. Of course, there is a way of snatching defeat from the jaws of victory, also covered in Alex' presentation:

JSR 299

My final presentation was Gavin King's talk on WebBeans, erm, Contexts and Dependency Injection or JSR 299. Gavin is an opinionated speaker--good thing his opinions were pretty close to mine. He was very enthusiastic about EE6 (provided, of course, it includes JSR 299). As he puts it, finally the EE stack will be fully usable without 3rd party addons.

The web profile removes a lot of old cruft. I agree--cruft removal is excellent. He says JavaMail should have been added. Agreed too--all my web apps seem to need JavaMail, usually for password recovery.

He spoke kindly of JSF 2.0. It fixes "all the problems". Ed Burns, whom I met later at the Java EE party, basked in that statement :-)

There are a lot of things to like in WebBeans, erm, Contexts and Dependency Injection. Gavin will tell you about the benefits of loose coupling with strong typing. But I'll be more pragmatic.

JSR 299 gives us @ConversationScoped (think multiple NumberGuess games in different browser tabs). Maybe that should have been part of JSF 2.0, but I take it any way I can get it.

Your JSF apps can reach stateful session beans directly from JSF pages, without having to fuss with managed beans. If you are willing to deploy on a real app server (and not Tomcat), that greatly simplifies your architecture. I am not saying that every web app should do that, but it is a very useful option to have, as evidenced by the success of Seam.

JSR 299 has a very clean approach to switching between testing and deployment scenarios.

Gavin promises a proposed final draft of the spec by Monday. During the Q&A, he sad that, in hindsight, JSR 299 should maybe have been an SE JSR. I asked about potential conflicts with 330? Gavin said that JSR 299 has no (portable) solution to a standalone bootstrap outside a Java EE container, which JSR 330 provides. He'll be glad to adopt whatever they come up with. But the fact remains that there are gratuitous naming differences between the JSRs.

At the Java EE party, Ed Burns introduced me to Bill Shannon who oversees Java EE. Bill seemed genuinely perturbed by the conflict between the two JSRs. I hope this gets resolved in a positive way. As an app developer, I really want the benefits of WebBeans in Java EE 6. Sure, I could always use Seam, but that removes the "one stop shopping" advantage from Java EE.

At dinner with my co-author, David Geary, and my editor, Greg Doench, we talked about the Winchester Mystery House[3], the building constructed by the widow of the gun manufacturer who was obsessed about the spirits of those killed by the guns. The house has over a hundred rooms, most with no purpose, windows that don't open, and stairs that lead to nowhere. As one of the dinner companions remarked, just like the JSF spec. Ouch!

Tomorrow, too early in the morning, David and I will be in a Second Life[4] chat. Please join in if you are into that kind of thing.

Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Participation.