Sunday, October 21, 2012

Clojure vs. Scala smackdown

Just kidding with the title of this post :-)

I believe in using the best tools for any given task, but this is not always possible when working with teams where most developers already know one programming language and/or framework. Also, as a consultant I usually favor using which ever tools are already used in the customer's organization.

All that said, I find that alternative JVM languages like Clojure, Scala, and JRuby are so much more effective for the projects that I work on that I have a strong preference to not use Java.

I find the decision when to use JRuby to generally be easy, using it on projects requiring fast development, web services, and as glue code for existing Java software. Increasingly though, I am viewing Scala and Clojure to be almost as agile as JRuby, with much better runtime performance.

For me, the tough decision is between Scala and Clojure. Taking Martin Odersky's Functional Programming with Scala class definitely affects my decision because I feel like I am learning best practices for Scala development and I am enthusiastic about using it for new projects. To balance that out I have bought and read four books on Clojure and I have used Clojure a lot in my work in the last several years and Clojure is a pleasure to use.

Although I have conflicted and undecided views on when to use Scala or Clojure, I do believe without a doubt that Rich Hickey and Martin Odersky have designed, implemented, and maintain two languages which blow "plain Java" away in developer productivity. For our industry, this is a problem because there are so many Java developers who are already trained using Java and Java frameworks, and there is a lot of inertia for not learning new languages, especially like Scala which has a steep learning curve.