Julian Exenberger has an interesting post where he states that of the top 10 languages on the Tiobe index, Java is the only one not to support closures in any way, either officially or by at least som kind of (planned) support. He goes on to state that Java is going to be perceived to be obsolete, and it's going to be a harder sell in the enterprise because of this.
Another possible explanation
It might be that the Java crowd is panicing about the wrong thing. Surely, Java.next, as Stuart Halloway describes in his article Java.next: Common Ground might turn out to increase productivity a lot, but I guess language features are not the reason why some1 developers are leaving Java for Ruby or less known languages. I guess the reason why Ruby got popular is because of Rails2. Sure, the Rails people argues that it's better because of things like "metaprogramming", dsl's etc., but then, why is it possible to make an equally good, if not better, web framework in PHP? And why is everyone still talking about Ruby, and not about Django, TurboGears, symfony?
Here is what I guess: It's because of the enthusiasm in the Ruby camp. They're not very many, but they have a good language, they innovate, and they make a lot of noise! What Java lacks most is enthusiasm. Innovation can be copied (it's mostly open source), and lack of language featueres can be programmed around3, but not without enthusiasm, that is not going to happen.
Of course there used to be a couple of reasons for that lack of enthusiasm, but they're starting to really fade away. Here are some examples:
- There used to be a lot of xml to be written to make even the simples web application with Java, but now you don't have to write a single line of xml to get started.
- Java user interfaces used to look really ugly, but now the can look really nice.
- Java applets was never an alternative to flash for multimedia, but even that is about to change, with javafx starting to pick up steam.
Java has some unique features that makes it stand out. If we want Java to succeed, advocates of the language should focus on things like:
- Supported by multiple big companies.
- Secure. Java is widely perceived as a very secure programming language.
- A clean language.4
- Very good ide and debugging support.
- Both Ruby, python and PHP are available on top of the Java platform, together with some Java-only languages like clojure, scala and groovy.
Java isn't dead, and it doesn't need to die even if Sun doesn't add all those cool features people are asking for. Start beeing enthusiastic!
1: Yes, I'm not writing many. Most of us still use Java, and it even seems that more people are still searching for java programming than for ruby programming: http://www.google.com/trends?q=java+programming%2C+ruby+programming
2: I guess this is evidence enough: http://www.google.com/trends?q=ruby+programming&ctab=0&geo=all&date=all&sort=0
3: Yes, I am talking about my favourite web framework, symfony. Programmed in php, which, in case you didn't know has no closures (yet), and is not elegant at all, but rather ugly. I mean, having to prefix variables with $, and using "->;" instead of "." is just ugly. But that doesn't prevent sensiolabs from creating a super effective web framework out of it, and it has not prevented yahoo from choosing it over rails for both the new delicious site and yahoo answers.
4: I sometimes spend some hours maintaining Delphi code, and there is a couple of features that I really dont like, like the "with" keyword, that saved the previous author from some typing at the cost of making that hundred lines function even more unreadable, and the possibility to mix two different classes in one unit, and even mix the implementations!