Wednesday 30 March 2011

Java 7 musings

With great anticipation I downloaded the new Java 7 preview, like a kid with a new toy I unwrapped it in a hurry and wanted to play. It was not long before the sense of disappointment set in. As a professional Java developer I will be happy to move from Java 6 to Java 7, as a passionate Software Engineer I am deeply disappointed and I find that my mind is increasingly leaving the Java sphere (even if my pay check is not). New languages such as Haskell, and Scala are really pushing for my attention.

There are several very nice new features in Java 7, and a couple little tidy ups that will have a big impact on my day to day development such as not having to duplicate generic declarations everywhere. The new NIO features and concurrency enhancements are great however closures are once again out, and the try with resources enhancement promised to be oh so nice looks ugly! (and yes, aesthetics count! they effect readability and maintainability of code.. ie the final cost of the product).

Java is a fantastic language, however it now has so much weight on its shoulders that it changes slowly and the pressure for backwards compliance (which they have done a fantastic job with) is resulting in syntax that is messy and painful to read. Specifically I refer to Generics, the new try with resources syntax and most of the closure proposals. It is with little wonder that we are now seeing a wealth of languages pop up on the JVM, they are now where the new language features and experiments are occurring (i.e. Scala, Groovy, Closure and Ceylon). As Java becomes increasingly adopted as the language of choice for business, so its rate of innovation is dropping.