samedi 15 août 2009

I don’t know how I could ever go back to Java

I've been developing scripts in Python to handle replication issues against a cluster of Subversion repositories. It was fun. Python is definitely my favourite scripting language because it's a high-level language and helps writing concise programs. Then I went back to Java. I've been developing in PHP recently. I built an entreprise application on top of Cake PHP stack, a Ruby on Rails like framework quite popular in the PHP community (like its clone: Symphony). Cake provides every feature you need out of the box. I figured out how dynamic language is straightforward when it comes to Web development. "Convention over configuration" + Dynamic language is the right combination to Keep It Simple Stupid. Wait! I could KISS with GWT too. Bruce Johnson, the creator of GWT, managed to compile Java source into javascript. Nice job! Bruce introduced overlay types that are JSNI behind the scene. It is not a new comer for those who developed with JNI a decade ago. There ain't nothing new under the sun right? But deferred binding in GWT is truly a reification of an abstract concept in compilation theory. Deferred Binding is a fully generic mechanism for handling features that vary according to some context ( browser ;) ). This concrete application of deferred binding has made GWT a cross-browser framework and smoothed RIA development. Its hosted mode speeded up my learning curve with a very short edit-compile-test cycle, just like Cake PHP. I went back to Java with GWT. Beyond GWT, there 's something interesting from the HR recruiter perspective. There are millions of legacy code lines written in Java in the world, good ones and bad ones. Entropy makes it harder and harder to maintain production systems and commercial softwares. That's why Java was and will still be in the job market. When a recruiter wants to hire a developer, buzzwords help identifying candidates' development skills. I completely disagree with this simplistic approach however it's the way it is in most organizations. Now, to develop Web applications or to maintain legacy codes, organizations will still hire Java developers instead of polyglot developers who knows HTML and CSS. Why? Because finding a Java programmer in the job market is cheaper, faster and easier. A Java developer can learn easily GWT without having to learn HTML, CSS and Javascript according to a company recruiter. The spring founder Rod Johnson (another Johnson :0 ) said once : "If you think Java developer are monkeys they will be monkeys." in reaction against the EJB. I do think that the real monkeys were those employers or employees who considered Java as a unique way out. Beyond the intrinsic aspect of Java, its predominance in the job market has delayed the adoption of a new language. Inside my company, there is an active community of PHP programmers. Many of them argue that Java is dead while saying : "Well, in PHP we don't have NullPointer Exception" or "PHP is so fast, Java is too slow". Alright. As for me, they don't make the point. Java is fast, almost as fast as C. If you get NullPointer exception or memory leaks it has something to do with Java skills. Whatever the language, there will still be monkeys writing error-prone programs, reinventing the wheel, with preconceived ideas like "Thread-safety ? Who care? I'm using sessionBean" when they don't know Servlet is not thread-safe. So far, I always went back to JVM. What I like in Java is its JVM. It makes Java portable, fast and extensible. I wanted to try out a dynamic language running against the JVM like Groovy. And once I read "Beginning Scala" by David Pollack. I just had the feeling that I didn't know anything about programming when I read his book. I felt the same as James Strachan did when he said : I can honestly say if someone had shown me the Programming Scala book by by Martin Odersky, Lex Spoon & Bill Venners back in 2003 I’d probably have never created Groovy. I will explain in my next posts why "I don’t know how I could ever go back to Java". It's not a break. Just a continuation. Scala is my new JVM partner.