Which one should I learn? Scala or Clojure
In the long run, probably I will learn both. But which will give better ROI?
Some parameters are:
> ease of learning > tools available > ease of integration with Java > libraries available
> ease of learning > tools available > ease of integration with Java > libraries available
6 comments
[ 2.8 ms ] story [ 21.4 ms ] threadHowever, I would recommend Clojure as the language to learn. The community is very beginner friendly, the language takes me to interesting places and some of the libraries are so elegant they are an absolute pleasure to use.
I believe learning Clojure is a good investment - as it matures more parts of the Java ecosystem will be covered by Clojure libraries, its a good practical way to learn a Lisp (which is worthwhile in itself) and its a good practical way to appreciate Emacs (which is worthwhile too).
Clojure has taken the lisp baton from CLisp and Scheme, if you want macros. But even without them, the underlying semantics for concurrency look promising.
If you need to run websites on the JVM, use JRuby on Rails.
With clojure, on the other hand, if you haven't done "functional" programming at a large scale you literally have to relearn "how" to program. You don't have state, you can't assign variables, you only sort-of have objects, and there are all these funny parenthesis all over the place.
So first ask yourself the question "who are you going to be programming with" and "what do you want to learn".
I've written and deployed non-trivial production systems in both and I'm fond of saying that scala drove me to clojure. I'm not trying to start a flame-war or anything [1], so let's start with the good stuff:
* you get functional constructs & concise iterators
* ruby-like mixin functionality is awesome (implicits) - this allows you to architect using composition over inheritance which is a huge win over java imo.
But...
* the syntax of scala can get quite perlish at times (my favorite being the "crying-kissy-face-operator" :_* [2]).
* the strong typing can be maddening. For instance, if you're trying to use two different JSON libraries (as in early days of Lift) you have to do all sorts of ugly type conversions. This leads to type boxing and...
* For "nothingness" tests you have: Null, null, Nil, Nothing, None, and Unit. Fun. [3]
* inline-xml (who asked for this?)
It was when slogging through a Lift-based recommendation system that I discovered clojure and I have to say, I love clojure. You can program in a lisp but still use the gobs of java libraries available. The syntax is straightforward, the performance is good/acceptable, and because it's on the jvm you can use it in Hadoop etc.
So while it does take longer for an OOP-minded person to think in more functional terms, I think you'll find that learning a lisp will make you a better OO programmer.
* [1] I have tons of smart friends who love scala. I like scala better than java, but if I had my pick, I'd pick clojure over scala. YMMV
* [2] http://www.mail-archive.com/liftweb@googlegroups.com/msg0822...
* [3] http://blog.sanaulla.info/2009/07/12/nothingness/