November 21st, 2011

by Ivan St. Ivanov

Discussion panel

Each Java conference starts with keynote and most of them end with a discussion panel. There some of the most respectful people of the industry come on stage and answer the questions from the community. Devoxx is not an exception – on Friday morning we had Oracle’s Brian Goetz and Mark Reinhold, Google’s Josh Bloch, JBoss’s Emmanuel Bernard (actually he was representing the open source movement), JUGs’ representative Ben Evans and Brian Prince from Microsoft (:-)). The talk was moderated by JavaPosse’s Joe Nuxxol and Carl Quinn. Joe was posing the questions that everybody had the opportunity to ask in a Google Moderator group. All the speakers had foil hats, which they put in case when they could not answer certain questions for “political” reasons. Fortunately the hats were used just a few times.

I again will try not to paraphrase each question and the answers. I will give just some statements that were interesting to me:

  • The definite winners of the Oracle – Google lawsuit (and all the other lawsuits on patents) will be the lawyers. The losers will be the developers
  • If Java and its successors want to be successful, then they should avoid creating incompatible dialects like there are in C++
  • Oracle’s corporate culture is better for Java than Sun’s. According to Ben, Oracle did not place any barriers in front of the community
  • Open sourcing doesn’t mean just dumping code on the internet. A lot of big companies that have done it that way, have miserably failed
  • The Java language did not become much more complex than it was in 1.02. Just the level of abstraction rose. It was the same in the very beginning: the first versions hid memory management from the developers

Of course there were some flames on the scene as well. Josh Bloch: “What is JavaFX?” Mark Reinhold: “What does Android have to do with Java?”  We heard also Joe ask Emmanuel a question in English, but with French accent. Which reminds me that the French people were target of a lot of jokes during this conference, most of which friendly. They will surely strike back on DevoxxFrance next April.

Evolution of Java

This was the second talk by Josh Bloch on Devoxx and it was a sequel to his first one about the first version of Java. I will not go into too many details here as my nosoftskills co-blogger already did it (thanks, Stoyan ;-)).

So Josh evaluated all the 17 language changes made after the inception of Java in 1995. The criterion for that was whether they kept the feel of Java, defined by James Gosling: Java should be a blue collar language. One that takes all the good stuff from the existing languages and in the same time stays simple enough to be understood by the average programmer.

The most bashed features were serialization and generics. The first one was criticized because it does a lot of things behind the scenes: introduces hidden constructor, by default leeks private fields (unless not explicitly declared transient), it breaks the hashes of the serialized objects, so structures like hash tables, where these objects reside, are also broken, etc. Generics were basically fine before wildcards were added in the last moment. With this last minute act they introduced big complexity (the FAQs are 297 pages long) and harmed the feel of Java. The erasure of the generic type during compilation (done for backward compatibility with raw types) is just the opposite to what is done with arrays – they pertain their type in runtime. This impedance mismatch hides a lot of puzzlers inside and Josh has some of them in his book.

On the other side we have features like enums, foreach and annotations, which help a lot in simplifying the language, the runtime and in bringing type safety. Josh confessed that he has not tried intensively the new stuff in Java 7. However he said that Joe Darcy and his team have done a great job in their definition and implementation. And all the new features in the latest release got good ratings. Let’s hope that next year we’ll not have to watch yet another Java 7 puzzlers talk on Devoxx.

The Ceylon programming language

The last talk that I attended on this year’s Devoxx was about the Ceylon (pronounced Se-lon) programming language. Like Kotlin it was one of the JVM languages that emerged this year. Unlike Kotlin it did not have a compiler and IDE support. Well, not any more. Emmanuel and Stephane announce the brand new project site, where you can download the Eclipse plugin and find out how you can get the compiler.

The goals of the language are: easy to learn, less verbose than Java, very type safe (i.e. statically typed), hierarchical structures (like XML, UI, etc.) should be better expressed, etc. I have also heard that its target would be people writing business application. As the language author is Gavin King (the creator of WebBeans, a.k.a. Seam), I would not be surprised if we see contexts and dependency injection (CDI) as part of the language. Some of the most prominent features of Ceylon are:

  • Everything is by default final. If you need to mutate your variables, you have to express that explicitly. If you need to override a method you have to declare that explicitly both in the parent as well as in the child class
  • Method overloading is not possible. However, methods can have default values for their parameters, so you can omit them when calling the method. This looks like currying
  • Interfaces can define default implementations for their methods, just what we expect in Java 8
  • There are no primitive types
  • There are optional types (String? s). When you have such a type, the compiler explicitly checks whether you have a check for null before invoking a method
  • There is operator overloading for a limited set of operators. You cannot redefine new operators as it is in other languages. The way to overload (or override actually) an operator is by overriding the respective method. For example for == and != you need to override equals

There are a lot of cool features that can be looked up in the documentation. What I didn’t get is whether it supports Java in the way that Groovy or Scala does – can you write Java code inside Ceylon classes. I didn’t get also how you define the main method of a module. But anyway, this is not so important. More important is the following observation: we have several new languages (I mean serious ones) coming out each year. Every one of them claims that it solves most of the problems of Java and that it does it in a better way than the other ones on the JVM. Every new language usually also adds something unique (e.g. Ceylon has a different type system). OK, that’s fine, it’s great that lots of people in the community are creative and I do believe in Gavin King’s creativity. However, I still cannot find what’s in for me in most of the emerging JVM languages. And the Ceylon guys have still much work to do (which they realize even better) to bring me on their side (not that I am particularly important to them ;-)).

The good part is that they are doing the things in the right way. Just to mention some other observations:

  • It’s not necessary that the language is backward compatible (it’s not decided yet though)
  • The Ceylon team values the community (which I guess is the JBoss culture) – everything is on Github, there are mailing lists, even the project page can be edited by people from outside
  • They tend to avoid lots of Java fallacies (e.g. threads and parallelization are part of the libraries not of the language)

Good luck guys, I’ll be watching your progress!