Back from JaZOOn, Fourth and Last Day

28. June, 2007

In the morning, Neal Gafter gave some insight into “Adding Closures to the Java Programming Language“. You remember anonymous classes? Well, closures are similar but solve all the problems associated with it: You can access and modify variables from the surrounding method, for example. You can use closures to replace all the listeners in Swing. Look at this code:

 InputStream is = createStream();
 try {
    doSomething(is);
 } finally {
    try { is.close(); }
    catch (IOException e) {
       log.warn("Error closing", e);
    }
 }

What do we have here? The actual information is the “doSomething()”. That’s where the interesting stuff happens. Everything else is boiler plate code. Now imagine you must change the logging. You have copied this code a thousand times. The stream has often a different name or it’s a Reader. You can bet that you’ll forget to make the change in at least one place. Okay, it’s just logging, but how often have you seen this pattern repeated? A piece of code where the meat is embedded deeply into some other Java code and the whole thing is duplicated with cut&paste all over the place. That’s what closures are for:

 with (InputStream is : createStream()) {
    doSomething(is);
 }

with() is a method which takes two arguments: An InputStream and a Closure. The code for with() looks somewhat like this:

 void with(InputStream is, {InputStream => void} block) {
     try {
         block.invoke(is);
     } finally {
         try { is.close(); }
         catch (IOException e) { log.warn("Error closing", e); }
     }
 }

As you can see, the code wrapping the closure is now in one place. The same pattern can be used when reading objects from a database (in this case, with() could handle the opening and closing of connections, statements and ResultSet’s). Neal showed examples how to use this in listeners or how to have a loop in the with() method. In this case, “break” in the closure can exit the loop (if you have read enough objects from the database or enough files from the file).

Great stuff. Late but great.

After him, Danny Coward showed how Java will evolve into Java SE 7 and Java EE 7. Not many surprises here. Sun aims for a 18 to 24 month release cycle. That is should give the expert groups enough time to come up with great and stable features. We’ll see about that. I would prefer if they came up with useful features that made developing software easier. For example, annotations in Java 5 could have been a great feature but they can’t modify the code. Makes sense from a compiler point of view but castrates the feature. And don’t get me started with generics. I couldn’t even name a feature of Java 6 that I had seen and that I feel helps me in my daily work.

Enough of that. Where does the big world spin to? Henry Story showed Web 3.0 (and Web 2.7 a.k.a Freebase). The “Semantic Web”. Every information annotated with an URI to tell what it is and how it is related to another information. The whole world seen in 3-tuples. Unfortunately, tools aren’t there, yet. If you don’t want to use VI and cwm, there is not much to chose from. You can try Protégé, Swoop or a commercial product TopBraid Composer. All this looks very promising, especially in relation to JCR/Apache Jackrabbit. Jackrabbit allows to store structured and unstructured data and manage it (search, modify, import, export). This is one step above relational databases which offer only very limited capabilities when it comes to data which is only partly structured or not structured at all (like texts, images and videos). If you’re lucky, you can store this types of data but searching it? Forget it.

The semantic web (SW) looks at the problem from the other side: It allows to annotate data with types, so you can know (or rather, your programs can know) if two “things” are the same, similar or related. Example: You are a person. You have a name. In the SW world, “you” is an object or entity of type “Person”. Your name is a value of type “Person:name”. If you know someone, you can attach the relation “knows” to the entity “you” and then refer to other person objects. Since the code walking this graph knows that it’s traversing persons, it knows that there are names somewhere so it can display them on the screen when you list all the people that you know, etc. For more information, see Henry Story’s BabelFish blog. Maybe start here.

He explained many more details and answered questions in the long Q&A session after his talk. I wished there had been more of these. Many talks raised interests but 5 minutes were never enough to ask any complicated questions.

The talk “JCR, the Content Repository API for Java” wasn’t very interesting for me because it mainly focused on the API. Peeter Piegaze showed different node types and typical Java code. Therefore, I didn’t attend “Content Management with Apache Jackrabbit” but “Development of a 3D Multiplayer Racing Game“. I had hoped for some insight into the problems Evangelos Pournaras had ran while developing the game or details of the physical simulation. Instead, he listed the features and showed the UML diagram of the game. I was very disappointed.

Afterwards, the conference closed with the Jazzon Jam. Over the several days, the moderator had told us about something called “Lighning Talks”. People were supposed to walk on stage, get the mike for two minutes and talk about whatever they want. I was a bit suspicious of the concept but it works. Speakers don’t have time to dally around (setting up the laptop counts against the two minutes!) and get their point over quickly. A nice way to close a conference.

All in all, a positive experience. If possible, I’ll attend the Jazoon’08.


Back from JaZOOn, Third Day

28. June, 2007

There are several ways to rate a conference. Here is mine: How many time do you spend bored in the lobby/outside the conference and/or how often do you wish you were bored outside of the talk you’re currently sitting in?

Looking at it from this angle, Jazoon is doing great. Go, guys, go!

The keynotes today was Eclipse Way to Jazz by Erich Gamma. It took me some time to figure out what Jazz actually is. There was no abstract and Erich rushed us through the talk. Apparently, it’s a tool to design a software process in the Eclipse way: Help you to get your things done without getting in the way (at least as long as you can keep the pointy haired boss (PHB) away from it). This looks pretty promising, even for a process-hater like me (seen too many processes imposed by PHB’s who think anything can be solved by micro-management) since it allows you to keep track of all the info (for example all bugs, the state of the current build(s), messages from team colleagues, your todo-list) in the IDE so you don’t have to go back and forth between tools to keep track of all this non-coding work.

It’s planned to be a commercial tool which is understandable but still a pity. OTOH, how many OSS projects need to keep a schedule? Some part might be available for free but not Open Source. We’ll see. I was impressed with the UI which looks pretty slick for a Java app, even when using SWT and forms.

Next in my schedule was of course “Why can Groovy succeed?” held by Mike Müller. Many nice arguments but I was missing the main point: Groovy (or any other language or Java library or whatever) will succeed as soon as one of the main players (IBM, Sun, etc.) adopts it. Large customers (= those who pay bills which get converted into developer paychecks in turn) will not adopt anything that isn’t backed by big companies. I’ve heard that “Oracle backs Groovy and Grails” which is promising but, despite Larry being one of the richest men in the world, well, Oracle is not IBM. I don’t want to be the bad guy here but … well … let me put it this way: If you plan to buy a new telephone, are you going to ask your plumber which brand you should get?

Sun’s support is half-hearted at best (“We don’t care which language it is as long as it runs on the Java VM”). Let’s see if IBM can afford to spare some attention. If you want to learn more about Oracle’s stance, here is a press release. Good luck to them.

Next, JavaFX. I’m someone with broad interests and I know a bit about design, too, and layout. For example, I know what a “river” is (when whitespace in adjacent lines creates verticals gaps in texts that irritate the eye) and I’m using TeX to layout my texts (which not only formats it nicely but also gives me feedback how “bad” a paragraph looks). When I first heard about JavaFX, it was just another UI description language. Oh bother. Instead of creating a good UI builder like Adobe’s Flex 2, they created another programming language. And no, Matisse doesn’t cut it. Matisse does Swing and a swing is something kids have in the backyard. It’s a toy. In 2007, Swing UI elements still can’t be connected to bean properties without the help of some extra library. In 3.3, Eclipse at least comes with the binding framework.

Back to JavaFX. Designers will never ever touch a text editor even if their lives depend on it! They use Photoshop or Illustrator or Flex. Tools that can do all kinds of amazing things with just using your mouse or *gasp* a pen tablet. Any software developers here? Who has a pen tablet attached to his computer? Ever used one? Forget about text editors. That’s just like asking your boss: “Why don’t you come to work with a VW Golf instead of your Lamborghini? I would feel much better!”

“Who cares what you feel? Get to work! The rates for my fourth Porsche aren’t payed, yet!”

Ahem. Where was I? Oh yes, JavaFX. At the Jazoon, they showed quite a few very nice demos what you can actually achieve. There was the usual boring stuff (showing that you can type in some code and the result of that code is shown in near-realtime) but they also converted the Tesla Motors website into a JavaFX app which looked and behaved so similar that you could only tell the difference by looking at the header of the window (one had the browser toolbar in it). Nice and smooth transitions. JavaFX connects Swing, Java 2D and it supports data binding, something that should have been in Swing 1.0 (when it was still called JFC).

Unfortunately, they didn’t show how the code (i.e. how many horrible hacks they had to use to make it work) but apparently, you can download the demo and see for yourself. So it looked pretty slick and nice and appealing. I’m just not really convinced that the designers will swallow the JavaFX pill. Sun is concerned that there is no compiler for JavaFX, yet, but designers don’t care about compilers. They care if they can do anything from their pen tablets. A designer will only touch her keyboard when she has to add the few lines of text to her work.

On the positive side, Anatoli and Greg gave a great show. Thanks, guys! For all the companies out there who think about sending someone to present them at a conference: Send two guys who get a long with each other very well. That way, one of them can do the presentation and the other can use her/his head to keep things interesting. Also, that way, more of your staff gets free conference passes. Win-win.

A short break during which I rode the elevator with Bruce Willis. Well, not actually Bruce Willis but his character John McLane. And not the character as such but an image of him. Many in fact. Thousands. 24 * 60 * 60 … bc to the rescue … 86’400 … but he’s not on all of them … say 50% … that makes roughly 43’200 images of John McLane, give or take 5’000. If you still don’t know what I’m talking about: I was riding in the elevator when the cinema staff brought the second reel of the movie Live Free or Die Hard (called “Die Hard 4.0” in Europe) was brought in. I had a camera with me but I was too upset to think of taking a picture. You’ll have to believe me. I really was in that elevator …

The last show in the morning was Revisiting the Anything Pattern. An “Anything” is a data structure which has properties of a list (it keeps the order in which elements are inserted) and a hash (you can attach names to items of the list and access them by name). Nice and powerful, especially for configuration-like data. The guys around Stefan Tramm extended the original code so you can now read JDBC ResultSet’s into an Anything and write them back into the same or another database. Nice stuff. There is a google project at http://code.google.com/p/java-anything/. You can find the source at http://java-anything.googlecode.com/svn/trunk/. Don’t be confused that there are two directories there: “initial-release” is the original code as Stefan got it and “starting-release” contains the extensions of him and his team (including the DAO code). Use that one.

In the afternoon, we all enjoyed Die Hard 4. Nice movie, lot’s of action and good characters. Go watch it.