Codementor Events

5 reasons why Groovy programming language is still a valid choice in late 2018

Published Sep 25, 2018Last updated Mar 23, 2019
5 reasons why Groovy programming language is still a valid choice in late 2018

A few weeks ago Groovy programming language was celebrating its 15th Anniversary, which proves that Groovy is one of the oldest alternative programming languages running on JVM. You might think that development and high popularity of other younger JVM languages like Kotlin made Groovy less important in today’s tech world. Nothing could be further from the truth! In today’s article I would like to share with you 5 reasons that Groovy programming language is still a valid choice in late 2018. Let’s start!

1. Groovy is still growing

Groovy is still actively developed by a group of contributors - the next 3.0.0 release will drop the support for older JDK version (requires JDK8+) and will introduce a lot of new features and improvements, like Parrot parser that will allow using e.g. Java lambdas and method references in the Groovy code. The growing Groovy community warmly welcomes everyone and offer a support through community Slack or Stack Overflow contributions, to name these two at least. The initiatives like GR8DI help underrepresented minorities to begin their journey in Groovy ecosystem by education and collaboration. And last but not least - Groovy is still one of the most downloaded libraries in the Java ecosystem. Cédric Champeau mentioned some time ago, that Groovy was downloaded 23M times in the last 3 months - wow!

Groovy 23M downloads tweet

2. Groovy is supported by wide range of frameworks

There are different ways you can get introduced with Groovy. A several years back one of the most popular frameworks that was building Groovy’s position was Grails - a full-stack web framework that is still actively developed. In 2014 Spring Boot was released and started gaining a popularity - it also allows you to use Groovy as an alternative for Java. If you searched for a lightweight and extremely efficient framework you might heard about Ratpack, which was originated as a Groovy framework and even though it is a JDK8+, it still supports Groovy up to this day. And if you are interested in microservices architectures you might heard about most recent tool in the ecosystem - Micronaut which gains popularity while it is still 1.0.0 M4 in the September 2018. And if this is not enough, you can use Griffon - a Groovy framework for developing desktop applications. And not to mention Gradle - this is actually a build tool and not a framework, but its popularity and constant growth keeps Groovy on the radar (even though it supports Kotlin DSL as well).

3. Jenkins Pipeline as a Code

This item requires a separate paragraph. Even if you are not interested in any of frameworks mentioned earlier, you might still get in touch with Groovy. Jenkins Pipelines DSL uses the power of Groovy to create and maintain CICD (Continuous Integration and Continuous Delivery) pipelines in a very readable and easy to understand way. Especially declarative pipeline DSL is simplified and opinionated to make pipeline maintainer's life much easier. It also gives you unlimited options to script your pipeline to do exactly what you want. An obligatory tool in every DevOps toolbox!

4. Groovy makes unit and automated testing simpler

If I would be limited to pick only a single tool from the Groovy ecosystem, I would pick Spock Framework. No doubts about it. Spock makes writing unit tests (called “specifications”) 10 times easier and more enjoyable comparing to JUnit, TestNG or whatever else comes to mind. It’s simple, clean, readable and powerful library that integrates easily with any Java based project. I know many people that do not sympathize with Groovy programming language much, but they really enjoy using Spock as an alternative to good old JUnit in their Java projects.
There is also Geb - a Groovy browser automation solution that makes writing E2E test scenarios as easy as possible. It runs in browser or headless mode, produces test reports in a few useful formats and what is most important - it is very easy to use and write your first browser automation test.

5. Groovy boosts your productivity

And lastly - Groovy gives you a huge productivity boost when used correctly. If you want to experiment with something, you can simply write a Groovy script, use @Grab annotation to download any dependency from Maven central and do the work without any ceremony. If you like dynamic languages with strong types system, Groovy is good to go. You may rely solely on type inference and take advantage of metaprogramming making your code as DSL as possible. Or you may turn on static compilation and type checking if you want to instruct Groovy compiler to produce a bytecode that is pretty similar to the Java’s one (also almost as efficient as Java bytecode). And lastly - you can get rid of tons of boilerplate code and focus only on what is the most important in your daily job - providing solutions to the real life problems.

Conclusion

I hope you enjoyed this blog post and you have learned something useful about Groovy ecosystem. This ranking does not exhaust all Groovy ecosystem goodies, and that is why I would really like to ask you to share what do you love Groovy most for in the comments sections below. Happy Grooving! 😃

Discover and read more posts from Szymon Stępniak
get started
post commentsBe the first to share your opinion
Chris Malan
5 years ago

Nice post. I’ve been using Groovy for years coming from Java. Things are just so much easier to do with Groovy than with Java.

jeffreyning
5 years ago

i have developed a groovy framework to programe with java and spring.so people who use java can easy to use this framework.you can find the framework in github
https://github.com/jeffreyning/micro-mvc
https://github.com/jeffreyning/nh-micro
https://github.com/jeffreyning/micro-admin

Show more replies