Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Making Java Groovy vs Making Java Scala?

 
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Sheriff
Posts: 67595
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
gunslinger & author
Posts: 158
11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 864
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.

Burk
 
Bartender
Posts: 1051
5
Hibernate Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic