Tuesday, June 26, 2007

Back from JaZOOn, First Day

During the keynote speeches, someone mentioned that the streetcar no. 5, which goes to Jazoon'07, also goes to the zoo of Zurich. The good news was that the zoo was at the other end of the line, so JaZOOn (which apparently doesn't mean anything) is either not related to the zoo or it's related in such a way that it's the opposite.

I kind of disagree. A zoo is a place where you can see things that you normally can't and in a safe way. In this regard, Jazoon is a zoo full of Java animals and I'm a happy part of it.

Yesterday, I attended the keynote given by Ted Neward which was "Why the Next Five Years Will Be About Languages". He mentioned a lot of interesting things, like:

  • Tools to build custom languages (a.k.a DSL's) become more simple, more powerful, more widespread
  • The need to use there tools grows because it takes so much to formulate some things in general purpose languages like Java. What was great ten years ago seems clumsy today.
  • There is a plethora of languages that run on the Java VM (which is not Java(TM)) like Groovy, JRuby, Jython, Nice, Rhino (see here for a more complete list). He mentioned something like 200 languages using the VM besides Java but my memory could fail me here.

For me, this means that my own talk What's Wrong With Java?, where I compare Java, Groovy and Python, probably wasn't that far off. Of course, I was pretty nervous how people at a Java conference would take it (plus I got sick on the weekend, so I had to take so many drugs to be able to give the talk that, if I had fallen into the Lake of Zurich, they would have had to pump it dry and deposit the water as medical waste ;-) ... anyway ...).

Moreover, I had to rush through my talk because the time limits were really tight. All in all, I felt my performance could have been better but the critics seem fair. (see Fabrizio Gianneschi's comment, thomas and another blog). Also, the room in my talk was full of people; something I haven't seen for any other talk since (which probably means that I attend the wrong ones ;-)) and comments at the show were good, too (but I can't prove it).

I was thinking about registering a BOF but I just don't feel well enough, so I'll expand my thoughts and ideas a bit more here where space and time are only limited by your and my endurance. And you can think about your comments before sharing them with the world. Win-win, I'd say.

Back to Jazoon. After my own talk, I attended Space Based Architecture - Scalable as Google, Simple as Spring. The talk itself was interesting and made sense; unfortunately, my body demanded sleep and it takes what it can't get. So if you want to know any details, ask the person who sat next to me. I can only pray that I didn't snore. Not the fault of the speaker, I swear!

After having restored some of my energy, I went to see Impossible Possibilities - Programming Java an Unusual Way. The presenter, Michael Wiedeking, has the same problem with English as I: Great pronunciation but small built-in dictionary. Still, I could get what he talked about. He presented a way to implement a generator/corouting in Java 5. The basic idea here is that you have a piece of code which can return something to the caller and then continue it's work when the caller calls it again. Confused? Here is an example:

def parse(filename):
    handle = file(filename, 'r')
    while True:
        line = handle.readline()
        if line[0] == '#':
          continue
        yield line
        # <-- If you call parse() a second time, you will be here.
    handle.close()

parse() throws away every line that starts with a hash (#) and returns ("yields") all the rest. The interesting part is when you call parse a second time: It will not start with the line where a new file is opened but it will continue with the next statement after "yield", therefore reading the next line in the already opened file.

In Python, you can have as many yields in one method or function as you like. They work with recursion and exceptions. This way, you can run a complex algorithm until a certain point (when you have a first result to return), return it and then go on as if the return had never happened. You don't have to worry about local variables, closing the file handle, control flow. The language all handles it for you.

If Java, you achieve the same thing with two threads and about four or five hoops to jump through. This is the difference between a modern dynamic language like Python or Ruby: There are completely new ways to do things that are very powerful, simple to understand and (almost) impossible to do in Java.

I spend the rest of the day with Michael Wiedeking and Neil M. Gafter, arguing about checked exceptions until I was to tired that I crept home and went to bed.

No comments: