Tuesday, April 5, 2011

From Java to Scala

Believe it or not, there was a time when Java was cool!

But obviously this is no longer the case. Language features and syntax matter, and while Java still rocks because of its rich ecosystem of libraries and its VM, the Java language itself has stalled (Java 7 adds a few welcome but very minor improvements only).

As a programmer, you want to use the best tools at your disposal, and Java-the-language is no longer such a tool, nor is it likely that it will ever be again. It is missing crucial features that you can take for granted in many mainstream languages today, including closures, functional aspects, and much, much more.

Now if you are going to move from Java to another language that runs on  the JVM, Scala is an obvious choice as it is was designed to be interoperable with Java. There are other options like JRubyClojure, and others, but they are bigger departures from Java (e.g. Ruby is a dynamic language while Clojure is a Lisp dialect). 

So last summer we decided to experiment and use Scala to implement the XForms engine's XPath dependency system. The experience has been positive, and since then we have been using more and more Scala in Orbeon Forms.

The net result so far: we are happier programmers and we care and feel excited about writing (and talking about!) code again!

1 comment:

  1. Thanks for the post! It looks like Scala and other functional programming systems are starting to pick up speed. I hope you keep us informed on your progress.