Sunday, September 27, 2009

Languages for JVM

The Java language is mature and that in the software development world means that it's dying. The Java language was designed around object-oriented programming but the trend now is moving towards more functional programming (which is arguably better suited in concurrent environments). I've been looking at newer languages built on top of JVM: Groovy, Scala, and Clojure.

Groovy is basically a dynamic version of the Java language with some new language features such as closures (a feature in functional programming). In essence, Groovy is "Java scripted" inspired from Python and Ruby.

Scala is an object oriented language with functional language features. It is not a scripting language and has features such as type inference:

var t = new Tiger();

The compiler knows that t is a Tiger -- no need to do:

Tiger t = new Tiger();

This type information is available at compile-time which allows for compile-time optimizations, making Scala on par with native Java performance.

Clojure essentially Lisp-inspired language running on the JVM.

All the above languages do not differ much with their Java interop (i.e., you can pretty much call existing Java code directly). All reduces the verbosity of Java. If I had to learn one language, I would pick Scala. I think Groovy is too small of an evolution over Java (i.e., not much benefits). Clojure just seems to radical for object-oriented developers.

Here's some additional points in no particular order:

- Martin Odersky, father of Groovy, 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."

- Scala is available both JVM and .NET.

1 comment:

  1. Here's a theory-oriented talk about the problems (and solutions) with concurrent programming: