Groovy vs scala : functional programming showdown

Groovy vs scala : functional programming showdown

Years ago when Ruby was at it's height, Twitter dropped Ruby and moved to Scala; shortly thereafter, the Ruby 'fad' came to an end and Ruby was dumped by hundreds of companies. Recently the VP of Engineering for Twitter stated that he wished he had never used Scala and LinkedIn has started moving away from Scala as well. Is this the beginning of an exodus from Scala and if so, what are our options?

Well in Java there exists several functional languages bu currently the most popular are Java, Groovy and Scala (in that order). 

Groovy is most commonly known as being used in Netflix Asgard and as being part of the Android SDK for building Android Applications but aside from it beingover 4 times as popular as Scala and the only other Java language listed in the top 20 languages, there are alot of companies using Groovy in place of Scala...

So why should you use Groovy over Scala? Well let's compare the two side by side on a variety of metrics:

  • Maturity
  • Learning Curve
  • Functional Programming
  • Compatibility with Java
  • Developer Knowledge
  • Flexibility
  • Scalability
  • Syntax
  • Speed (Language)
  • Frameworks
  • Test & Deploy
  • Mobile Development



  • Scala was created in 2003 as a small project by an University in Switzerland (EPFL - Lausane) and in 2011, the creator received a government grant to create his own company, Typesafe.
  • Groovy was created in 2004 and the company was purchased bySpringSource (Makers of Spring, the most widely used Java Framework), then purchased by VMWare and managed by Pivotal for the last several years before moving on to become an Apache project.

Groovy is integrated into SpringbootAndroid SDKGradle build system and is used by Java and Scala developers every single day.

Scala has not had the resources, funding and community that Groovy has in order to grow and mature as well as Groovy did. It is this kind of sponsorship and funding that stabilizes a language, enables the community to develop libraries and plugins for it and nurture it to grow into a mature product.

At the same time however, Scala touted itself as 'the next Java' and chose a go-it-alone approach in alot of it's code making it difficult at times to integrate with Java and Java libs. With time this got better but it still is problematic and is one of the reasons Scala's parent company listed for it's recent rebranding.

In recent years, Scala was adopted by Twitter over Ruby but recently the VP of engineering stated that had they to do it all over again, they would not have chosen Scala due to it's difficulting in learning and integration. LinkedIn is also scaling back it's own adoption as well due to similar issues with Scala.

While Scala is being adopted slowly by businesses, Groovy has wide adoption in the devops community, web development and now in mobile development by companies like Netflix, Twitter, Facebook, Amazon and others through tools like Gradle, Spock and in frameworks like Android, Spring, Spring-Boot not to mention the popular Java convention over config framework, Grails.

Scala is also being used in some of these places like  Facebook, Netflix and Amazon... but some of these companies(like Linkedin and Yammer) are also dropping it just as quickly as they are adopting.

And but there is one place Scala is not being used... mobile.

Google uses Groovy in the Android SDK and even uses Groovy internally on several projects; Scala is not used internally at Google.

In fact, alot of Scala projects even use Groovy tools (ie Gradle, Spock). But Groovy projects don't use Scala tools because they don't need to. Groovy already has a robust community, an enormous library of plugins and full integration with Java.

In this case, Groovy has shown itself as a mature and proven technology. PeopleTALK about Scala, but people USE Groovy through a variety of different tools, environments and even languages (Gradle is a build tool used by Ruby and Python too).

Points : Groovy +1 and Scala +0.5

Learning Curve

In 2011, Yammer moved away from Scala because the learning curve, development time and compile time were TOO LONG. Even the writer of the first beginners guide to Scala says it has a 'High learning curve, slow to get productive'.

A VP for Twitter, Scala's main contributor, once stated at a public meeting, that given the choice, they would not have chosen Scala again. Some have taken this to mean the lack of integration with Java and Java libraries while others have taken it to mean the heavy learning curve for new developers. 

And even LinkedIn's recent move away from Scala has caused others to assume similar issues with the language; that it wants to be (as people in the Scala community state), a new and separate version of Java.

Groovy is noted for its amazingly fast development and ease of pickup; since most Java classes can compile as Groovy classes, Groovy is a flat learning curve for most Java developers. In fact it is has even been called the 'gateway drug' to Java. You can easily take a good PHP/Ruby/Javascript developer and have them coding Groovy/Grails in 2 weeks time.

Ramping up new developers in Scala, as one person put it, can take an experienced Java developer twice as long:

your new team member ramp-up time just went up x2. Even clean Scala is notably more cryptic for a Ruby/Java/Python person, due to both new concepts, and the spreading wonton use of infix syntax

Scala also takes EXTREMELY long to compile. In comparison, Groovy takes just a couple seconds. And because Scala is still a maturing language and community, it's support and documentation have a bit to go.

This all lends itself to a MUCH LONGER development cycle in Scala when compared to Groovy.

Points : Groovy +1

Functional Programming

Both Groovy and Scala are considered 'impure' functional language implementations. They are also BOTH OOP. Functional programming is a paradigm (much like oop) and a language CAN implement both. Things like pattern matchingtraitsimmutable collections and actors and promises exist in both systems.

Scala started off trying to be fully functional and wanting to be separate from Java but found itself being unable to use alot of Java libraries and tools and thus had to eventually makes itself more compatible with Java and Java conventions.

Groovy, on the other hand, was always just a layer on top of Java and 100% compatible and added functional programming aspects  to the language (rather than adding OOP afterwards like Scala). In fact, pure Java is Groovy code; all you have to do is change the extension and POOF! It's Groovy!

So for everything that Scala has, Groovy has it too...and then some.

Points : 2 each

Compatibility with Java

For all it's talk about hating Java, Scala CAN use Java libraries BUT has a hard time with interoperating with Java. This is one of the reasons why LinkedIn is dropping Scala. Scala has issues with 'static' members and Scala code cannot be used in Java code easily and without issues.

Groovy, on the other hand, has a FLAT learning curve and is merely a 'convenience layer' on top of Java so Java can be written in your Groovy code and be 100% compatible. You can write static code or dynamic code and have Java work with your Groovy code easily. You can write functional or object oriented (or BOTH) and Java will STILL be able to work with your code. In fact, you can declare your class as Groovy and write almost 100% pure Java INLINE.

In fact, 99% of Java code can convert to Groovy merely by changing the extension from '.java' to '.groovy'.

Scala unfortunately still has a few bugs to work out and is nowhere close to being as compatible.

Points : Groovy +1 and Scala +0.5

...ask alot of Java developers if they have used Groovy and 50% of them will tell you yes... and that they had FUN with it or they enjoyed it...

Developer Knowledge

Finding developers who know or who have worked with Scala is hard. As alot of Scala developers will even tell you, the ramp up time to Scala is very high. But ask alot of Java developers if they have used Groovy and 50% of them will tell you yes... and that they had FUN with it or they enjoyed it.

Most Java devs already have a pre-existing knowledge of Groovy from existing tools, prior experience, scripting in Java or just plain curiosity.

Scala on the other hand often requires retraining staff in a new way of thinking rather than making use of their existing skills and knowledge. This is where alot of people have issues with learning Scala and hence why people often complain of its huge rampup curve on learning the language.

Groovy is merely a 'layer' on top of Java and is so similar at times that 99% of Java code converts straight over without requiring changes. This allows Java developers to use existing knowledge.

Points : Groovy +1 and Scala +0.5



While Scala can ONLY be statically compiled, Groovy can be dynamic and/or statically compiled; you can enforce static compilation at runtime through @CompileStatic. Most Groovy developers actually write static code as it compiles better anyway; The @CompileStatic annotation can be added as a bean if wanted so you don't have to add to all classes or on a per class basis.

This makes Groovy AMAZINGLY flexible in that it can be a scripting language, a dynamically compiled language or a statically compiled language; It can be a functional language and an OOP language. You can mix functional code in OOP design and have the class called by a Java program and have it all work fine.

Scala developers will complain about this but sometimes you want a multi tool. And it all compiles down the same. It is what makes it perfect for use as a build tool (Gradle) and as an application development language.

Points : Groovy +2 (static & dynamic) and Scala +1 (only static)


The way that Scala developers are taught to develop and write code is with what is known as 'idiomatic syntax'. This is considered the normal way to write code and requires dynamic compilation causing the code to be 4x slower than Java.Scala can be slow but you can improve this through good coding practice. But there is no way to enforce this.

Scala developers say the same of Groovy and it's true for similar reasons.HOWEVER... Groovy can use @Typechecked and @Compilestatic to enforce good coding and avoid large amounts of dynamic compiling thus getting near Java and scaling as well as Java does.

And on a plus, since Groovy is Java (and not trying to be a replacement for Java), it integrates 100% with all Java frameworks, tools, libraries, etc seamlessly. Scala cannot same the same and often has to reinvent the wheel when it wants to use an existing Java tool.


Scala developers will often state that Scala has a very high learning curve vs Groovy which has a very short learning curve... and most of this is due to 'syntax'.

With Groovy, the syntax from Java was maintained and so this syntax is also very similar to other languages like Python, Javascript, Ruby, even C. In Groovy, valid Java syntax is valid Groovy syntax.

But Scala decided to drastically change alot of it's syntax which makes it very different from previous programming languages. When trying to convert from Java to Scala, you will find even the simplest syntax for passing variables to methods is VERY different.

In Scala, you spend alot of time trying to relearn how to develop FOR Scala. In Groovy, you transfer the skills you already have

Points : Groovy +1 

Speed (Language)

Scala developers LOVE to say Groovy is slow. They base this statistic on the fact that it can be run both statically or dynamically. They also quote benchmarks for the dynamic version of Groovy and compare it to the static version of Java to slant their statistic.

In actuality, Groovy is sometimes faster than even Java; Scala can be 2-4 slower than Java at times in several tests and at the same time appear faster than java in others.

Groovy can show similar stats in tests appearing faster than Java at times due to the way it compiles and at the same time can also appear slower in other tests.

Both languages have similar speed footprints and it is truly difficult to tell which is faster without doing a side-by-side comparison with nearly identical tests on similar machines.

Needless to say, we can say that they are both similar in speed.

Points : +1 both



Both have good frameworks to support them but Groovys Grails Framework is based on Spring which is VERY mature and the most popular and well supported Java framework.

In a recent rating of Java frameworks by Matt Raible, Scala's Play framework ranked behind Grails/Spring due to lack of maturity, REST support, i18n, and lack of plugins/components.

And Spring support for Scala was dropped awhile ago due to lack of support;it was only ever so recently picked up by a solitary developer and exists in a broken buggy state.

Scala frameworks still lack plugins support in comparison to Groovy frameworks which have HUNDREDS of plugins and support of Spring.

And now Grails has even extended Spring-Boot microservice... so Scala has a bit further to go even there.

Points : Groovy +2 and Scala +1

Test and Deploy

Groovy has some great test and deploy tools that have become a standard in the Java community: Gradle is now built into the Android development toolkit and is even used by Ruby and Python developers for it's easy build and deploy.

Spock, a testing framework built in groovy, has become enormously popular in the Java community as well and has started to replace the standard jUnit in most developers toolkits.

Scala on the other hand has incredible difficulty in testing and mocking their environments.

Points: Groovy +2 and Scala +0

Mobile Development

Though you can do Android development with some Scala side projects, Google builds Groovy right into it's SDK with Gradle and Spock and companies like the NY Times have written articles about how they do all their Android development on Groovy.

Points : Groovy +1

So Why Does Scala Appear Higher In Language Rankings?

Languages are ranked based on 'chatter'. If you have poor documentation, you create more chatter? If your language is immature, it creates more chatter? If you have more bugs, you have more chatter.

However the inverse, if your language IS mature and has a million libraries to support, you create more chatter. If you have thousands of developers create hundreds of tools that hundreds of people are trying to use and maintain, that creates lots of chatter.

Scala has alot of vocal chatter because of constant code changes, incompatibility between versions, poor documentation, high learning curve and lack of maturity.

Groovy has overcome these issues and thus lacks this kind of chatter in its community.

Something to think about...

Many people like to point out that the ORIGINAL CREATOR of Groovy, James Strachan, stated on a Scala blog, how he wishes he had created Scala instead and that he would have never created Groovy if he knew Scala existed.

Of course,Mr Strachan's statements are most likely driven by an embitterness towards being removed as head of the Groovy project early on... ( 

Since then he has gotten over his bitterness and learned how much fun Groovy is again.

So while the Scala community may like to say 'the creator of the language prefers Scala', in actuality it is more a statement made in a moment of anger from the former head of the project.


Groovy: 15 points

Scala: 6.5 points

Overall, Scala is a language with a single focus that takes time to ramp up on while Groovy is a highly flexible and mature language that is easy to learn and is used for scripting, mobile development, web development, application development, tools and more..

So which do you use? What do you think is better? Thoughts?