aspose file tools*
The moose likes Clojure and the fly likes Clojure vs other JVM Languages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Clojure
Bookmark "Clojure vs other JVM Languages" Watch "Clojure vs other JVM Languages" New topic

Clojure vs other JVM Languages

Will Myers
Ranch Hand

Joined: Aug 05, 2009
Posts: 330

I'm a Java developer and have been messing around with Scala (via Coursera) and was just wondering what the differences are between Clojure and Scala? Why choose Clojure over Scala?
Hussein Baghdadi
clojure forum advocate

Joined: Nov 08, 2003
Posts: 3479

I would it is a matter of "culture" and "requirements".
If you need a powerful typing system, the ability to mix OOP and FP and Actors model for concurrency (Akka is available for Scala & Java btw), then go for Scala.
Of course this doesn't conclude what Scala is all about but I guess those are the strong selling point for Scala programming language.

Go for Clojure if you want to code in Lisp, a filthy rich data structures implementation, have a powerful Macros systems, a dynamic language and an easy concurrency model to implement multithreaded applications.
When doing multithreading in Clojure, I always feel I'm coding it in Apple's GCD which it is awesome!
chris webster

Joined: Mar 01, 2009
Posts: 1848

I did the Coursera Scala course last year and enjoyed it immensely. Then I did the excellent Coursera "Programming Languages" course, which included a section on Racket (a variant of Scheme Lisp) and a lot of core work on functional programming. So I have almost enough knowledge of Scala, Lisp and FP to be dangerous but nowhere near enough to be useful (yet). I really like the functional programming approach - even if I'm still struggling to apply it intelligently - and I liked the conciseness and power of Scala compared to "enterprise" Java. It seems I'm not alone there, as a number of major companies are using Scala to rationalise their JVM development (and goodness knows, JEE needs some rationalisation!). Incidentally, check out The Well Grounded Java Developer for some good stuff on polyglot programming on the JVM, including Scala and Clojure, or Seven Languages In Seven Weeks for an introduction to several different languages (incl. Scala and Clojure) and paradigms both on and off the JVM.

But Lisp really blew my mind and made me laugh out loud in sheer delight at the elegance and flexibility of a language that initially seems to consist of nothing but parentheses. For the first time in years, I felt like this was a language that I could really enjoy exploring and trying to get to grips with - even more fun than Python and much more challenging - so I decided to start finding time to look at Clojure more seriously, although it's still early days. No idea how far I'll get - I'm no CS wizard and my day job requires me to toil in the Java EE mines like a medieval serf, but it's good to have aspirations, eh?

Of course, I'm new to both Scala and Clojure (and FP) so what do I know? In any case there's no sense getting into language wars, especially when both of these languages are still on the periphery of mainstream commercial software development and will never replace Java as the "IBM" choice for the "enterprise". But for me personally, the key factor that lifts Clojure above all the rest (even Python) is that it's fun - and when I'm struggling to find a few hours to play around with a new language and a new programming paradigm, fun is a really important ingredient.

So my $0.02 on your initial question would be: unlike most Java developers, you've already got a grounding in FP and Scala, so why not look at different ways to apply the FP approach by playing around with Clojure to see if you like it? Even if you decide not to take it further, you will learn some interesting things along the way and it will almost certainly change the way you look at programming in general. And Paul Graham's essay on Beating The Averages with Lisp is still worth reading if you need further inspiration.

Have fun!

No more Blub for me, thank you, Vicar.
subject: Clojure vs other JVM Languages