Matt Raible: "Why is Clojure better than Scala or Groovy?"

2160 views
Skip to first unread message

Julian

unread,
Jan 15, 2010, 8:22:08 PM1/15/10
to Clojure
Matt Raible - Spring Expert and Java consultant posted the following
entry to Twitter:
"Why is Clojure better than Scala or Groovy?"
http://twitter.com/mraible/status/7793457551

He went on to say:
"Let's try that again: I like Scala and Groovy and see no compelling
reason to learn Clojure. Am I missing something?"
http://twitter.com/mraible/status/7794565786

I know that I think - but I thought the awesome community here could
help answer this question.

Rich Hickey

unread,
Jan 16, 2010, 10:22:19 AM1/16/10
to clo...@googlegroups.com

I would very much like to discourage the bashing of other languages
here. It is tedious and pointless. Should anyone be provoked into
responding to this, please keep your comments to attributes/deficits
of Clojure.

Thanks,

Rich

Chouser

unread,
Jan 16, 2010, 12:22:47 PM1/16/10
to clo...@googlegroups.com
On Fri, Jan 15, 2010 at 8:22 PM, Julian <julian...@gmail.com> wrote:
> Matt Raible - Spring Expert and Java consultant posted the following
> entry to Twitter:
> "Why is Clojure better than Scala or Groovy?"

If I had to pick just one specific feature (which may be a bad
way to going about answering this, but anyway...) I would say
"macros"

Clojure has full-on straight-up Lisp-style code-rewriting macros,
and this changes the game. Macros have a unique combination of
properties for a language feature: dramatically powerful, very
well understood (lots of material written about them), and yet
still relatively rare among popular new languages.

Many dynamic languages have meta-programming features that can be
used to fill some of the gaps left by lack of macros, so I wasn't
convinced of the power and practicality of Lisp-style macros
until I read Paul Grahams "On Lisp". I highly recommend it.
Even though it talks mostly about Common Lisp and therefore
Common Lisp macros, the macro discussions are very transferable
to Clojure. http://www.bookshelf.jp/texi/onlisp/onlisp.html

There are other reasons to like Clojure, but that's perhaps the
simplest one to name.

--Chouser
http://joyofclojure.com/

Shantanu Kumar

unread,
Jan 16, 2010, 1:10:15 PM1/16/10
to Clojure

I wrote about benefits Clojure (v1.0) some time ago:
http://bitumenframework.blogspot.com/2009/09/benefits-of-using-clojure-lisp-in.html

The best benefit of Clojure is, I think, the power-to-weight ratio.
The language is so much devoid of syntax and semantics bloat that
whatever code you write in Clojure is pure productivity. Concurrency-
handling makes it suitable for current-day development and as Chouser
noted, the Macros feature is a game changer.

Regards,
Shantanu

Laurent PETIT

unread,
Jan 16, 2010, 3:35:44 PM1/16/10
to clo...@googlegroups.com
One third "main selling point", just for you ;-) :

Clojure has a rooted in it a development paradigm suited to manage
state of identities over time.
That is, clojure embraces the "functional paradigm" for most of the
development process, but does not leave you "naked" when time comes to
write those parts of your application which require dealing with
state, time, concurrency, parallelism, etc.

Rich's videos are particularly enlightening concerning this point:

* a (mostly) clojure agnostic explanation of the problem and a
general solution to it:
http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey

* a more clojure-oriented talk which complements the above with clojure detail:
http://www.infoq.com/presentations/Value-Identity-State-Rich-Hickey


2010/1/16 Shantanu Kumar <kumar.s...@gmail.com>:

> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient with your first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

Jon Harrop

unread,
Jan 16, 2010, 6:44:51 PM1/16/10
to clo...@googlegroups.com
On Saturday 16 January 2010 18:10:15 Shantanu Kumar wrote:
> The best benefit of Clojure is, I think, the power-to-weight ratio.

That's a really good description for a low barrier to entry. :-)

--
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e

Mike Meyer

unread,
Jan 17, 2010, 3:00:42 PM1/17/10
to clo...@googlegroups.com
On Fri, Jan 15, 2010 at 8:22 PM, Julian <julian...@gmail.com> wrote:
> Matt Raible - Spring Expert and Java consultant posted the following
> entry to Twitter:
> "Why is Clojure better than Scala or Groovy?"

How about two reasons to learn Clojure instead?

1) Clojure is (a) LISP. According to Eric Raymond, "LISP is worth
learning for a different reason — the profound enlightenment
experience you will have when you finally get it. That experience will
make you a better programmer for the rest of your days, even if you
never actually use LISP itself a lot."

2) Clojure is designed from the ground up for concurrent
programming. It has a number of mechanisms that improve on locks for
managing state. Those come from other languages, and are liable to
appear in yet more languages in the future. If you're doing concurrent
programming, learning them will make you a better concurrent
programmer. If you're not doing concurrent programming, consider that
CPU improvement has changed from an exponential growth in raw speed to
an exponential growth in number of cores.

<mike
--
Mike Meyer <m...@mired.org> http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

Keith Irwin

unread,
Jan 17, 2010, 7:12:18 PM1/17/10
to clo...@googlegroups.com
I don't think you can really answer the question because it being asked in the way it that precludes a good enough answer. The tone of Matt Raible's request suggests that he'd really rather not learn it, and that there's no possible reason to overcome that reluctance.

Why travel? There's plenty of good food right here, and interesting cultural sites to see, and stuff to buy. But you don't ask that question: you just go, and FIND OUT why it was worth doing after the fact. (Or maybe not.)

Still. My take:

1. Clojure is dynamic like Groovy, and functional like Scala, so if Matt learned it, he'd be able to see what that's like.

2. It's a Lisp, and that's worth trying at least once, but it's on the JVM and a new dialect, so it lets you write Java in Lisp at first, and the lets you enjoy beginning to see new ways of thinking about problems.

3. Clojure has a flavor of STM that's database-like, and easy to use for the non-theorist programmer (i.e., folks like me who just write dorky business apps that aren't much more than shoving data to/from the web/database). This really cuts down on "threading" bugs, which are super hard to diagnose when the errors occur in production, which is always locked down and inaccessible to devs, debuggers, etc. STM doesn't help distributed concurrency (for which actors are better, imho), but it does help for a wide range of non-distributed use cases.

4. Clojure's macros make domain specific languages a natural part of programming. While Groovy's various Builders are pretty nice, it's not so easy to write your own builder, esp. if you're under pressure to get something done. For instance, I write a lot of Groovy apps, and I want something like Compojure. But the idea of figuring out how to use the Builder Support to do something like that just makes me tired.

Really, though, it's so hard to convince someone that one language is better than another significantly enough to be "worth learning" using "reason" or any other method. One just has to try it.

For me, Clojure/Lisp just works the way I do. Incremental, small functions, interactive, etc, etc generally as a result of super-vague requirements. Every time I write an app in it, I feel like the app gets smaller and simpler over time. I let myself write a lot of boilerplate (to avoid premature abstraction), then condense it all in a way that fits my app (not, say, a general lib), and the whole experience of it is positive. Better, smaller code, faster, and more fun to do (even if it's the same old business tasks).

So, Clojure "wins" or is "worth trying" because of the experience of using it, not because of some particular bullet point, which all languages feel like they all have.

(Personally, I'd really love Haskell/Erlang like pattern matching, not just destructuring or multi-methods (but those, too!), but even so....)

Didn't Paul Graham say something to the affect that a user of a "blub" language just can't see the point in other languages? I don't think Groovy and Scala are blub languages, but I think the idea applies, at least in an emotional way.

Matt should just give it a few weeks' try, like Tim Bray did.

Keith

Reply all
Reply to author
Forward
0 new messages