2008-08-18

Had a really strange problem with JSF before the weekend. A command button was supposed to save the form, but instead, the page would just rerender, as if it failed validation. It turned out to be just an ordinary null pointer exception, but it took some time to realize that because no stack trace showed up, and the h:message box was empty.

I guess sooner or later someone will search for this problem, so here is the post I found that solved it: http://forums.sun.com/thread.jspa?messageID=3263230  . I had to change it a little to get it to work, but I guess those changes has disappeared since then. (Of course I didn't submit those changes, as they were just for debugging.)

(Yes, someone is going to search for what you just found out, so you better start blogging now. Big thanks goes to everything is Broken for sharing how to get the Trust Flat Scan USB 19200 working under linux.)

2008-08-06

About Java, closures and attracting new developers

Background
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: 
Focus on strength

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.
I have left out the open source argument, and the multi platform argument, because both of these holds true for both Ruby, python and PHP.



Conclusion
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!