File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Groovy and the fly likes Making Java Groovy vs Making Java Scala? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Languages » Groovy
Bookmark "Making Java Groovy vs Making Java Scala?" Watch "Making Java Groovy vs Making Java Scala?" New topic

Making Java Groovy vs Making Java Scala?

Qunfeng Wang
Ranch Hand

Joined: Jan 28, 2005
Posts: 434
As languages based on JVM, I'd like to know how Groovy is different from Scala. Are there some aspects that Groovy is better than Scala?

To be or not to be. It's a question.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63540

Even though they are both JVM languages, they share no syntactic structure.

There is very little in Groovy that would surprise a Java developer; Scala is a completely different beast.

[Asking smart questions] [About Bear] [Books by Bear]
Kenneth A. Kousen
gunslinger & author
Ranch Hand

Joined: Sep 18, 2002
Posts: 99
Scala is a statically-typed language with immutables, which most people consider a bridge language on the way to functional programming. Its biggest success stories are the Akka concurrency library and the Play framework, and Scala is used as the heart of Twitter. It's a very powerful language, but also very different from Java.

Groovy is an object-oriented language, but with some functional capabilities (like collect, findAll, and inject, which correspond to map, filter, and reduce). It cleans up Java in a variety of ways while still letting you integrate with Java on a line-by-line basis. Groovy classes can implement Java interfaces, instantiate and use Java classes, and vice versa. The blend is (almost) seamless. It's similarity to Java also makes it very easy for existing Java developers to learn.

The other major JVM language is Clojure, which is a LISP on the JVM. It's a pure functional language with immutables. If our next major paradigm shift is to functional programming, as so many have said, then Clojure is a great way to get there.

If you're considering concurrency as your biggest motivation and therefore thinking about Scala or Clojure, let me mention that the GPars library has actors, dataflows, concurrent collections, and everything else you might need. The other "breakout" projects in the Groovy ecosystem are Grails (which is a web framework but more than that), Gradle (the build tool gradually replacing Maven in the open source world), and Spock (the unit testing library).

Btw, there's no real rivalry among the three languages. Which you choose is largely a question of style and personal preference. I will say that the Groovy community is very friendly and helpful, which was a plus for me.

Kenneth A. Kousen, Ph.D. (assorted certs), President, Kousen IT, Inc.
Author of Making Java Groovy -
Burk Hufnagel
Ranch Hand

Joined: Oct 01, 2001
Posts: 814
Kenneth A. Kousen wrote:It's similarity to Java also makes it very easy for existing Java developers to learn.

To me, Groovy is to Java what Java was to C++. Groovy makes it easier to write good code faster - and as a Java developer you already know how to write Groovy code. There's niceties you can learn along the way, and using Spock for unit tests is a great way to introduce Groovy to your development team.


SCJP, SCJD, SCEA 5 "Any sufficiently analyzed magic is indistinguishable from science!" Agatha Heterodyne (Girl Genius)
James Boswell

Joined: Nov 09, 2011
Posts: 1051

I will say that the Groovy community is very friendly and helpful, which was a plus for me.

From speaking to colleagues, I don't think the same can be said for the Scala community at present.
I agree. Here's the link:
subject: Making Java Groovy vs Making Java Scala?
It's not a secret anymore!