Groovy, an object-oriented scripting language that runs on the Java Virtual Machine (JVM), ranks number 18 on the TIOBE Index. Last year this time it was ranked number 53. Groovy is fully compatible with Java, making it easy to combine Java programs with Groovy.
However, as TIOBE notes, there is a lot of competition in the field of lightweight languages that fit together with Java. Yet, Groovy beats other well-known JVM languages such as Scala (ranked 36), JavaFX Script (ranked 41) and Clojure (ranked 76).
In an exclusive interview with eWEEK, Guillaume Laforge, Groovy project manager at Pivotal, said one thing that makes Groovy attractive to developers is that its main goal has been to simplify the life of developers, and particularly Java developers.
“Its syntax is based off of the Java language itself, so it’s very straightforward and intuitive to learn, but at the same time offers various shortcuts and APIs to make developers much more productive, help them write more concise and more readable code that is easier to maintain and evolve in the long run,” Laforge said.
Groovy also is the alternative language on the JVM that offers the best and most seamless integration and interoperability with the Java platform, as developers don’t need to convert from one system to the other as Groovy classes are plain Java classes and vice versa, he said. Moreover, Groovy is well suited for many situations, from writing small scripts to building more complex applications, as well as for designing Domain-Specific Languages (DSLs) for business rules and more.
“I’ve seen several financial institutions, insurance companies, travel or energy companies use Groovy for describing their business rules,” Laforge said. “I’ve seen actuaries defining rules for loan grants, scientists creating scientific simulations — nuclear risks, disease evolutions, etc., travel agents customizing booking processes and more. The easy Groovy syntax plus its ability to write almost plain English sentences which are valid Groovy statements makes it simple to write readable business rules.”
Laforge is well versed in Groovy. He is the Spec Lead of Java Specification Request 241 (JSR-241) whose role is to specify this new language. He also initiated the Grails project, which is a web application framework based on Groovy. Laforge has worked as a consultant building Groovy and Grails apps. He also was the co-founder and vice president of technology of G2One, which specialized in leading the development of the Groovy dynamic language and the Grails web framework. SpringSource acquired G2One in 2008 and was itself acquired by VMware in 2009. VMware later spun off SpringSource into Pivotal, where Laforge continues to lead the Groovy developer team.
Groovy Programming Language Sees Major Boost in Popularity
“Groovy is widely used in the industry as the 1.7 million downloads a year can attest, but there’s been an interesting surge in popularity recently,” Laforge told eWEEK. “In particular, as could be seen at SpringOne 2GX in September, Groovy was nicely featured in the Pivotal’s Spring.IO platform for example in the upcoming Spring Framework 4.0 version, in Spring Boot, or Reactor and other projects. There’s a lot of buzz around the Groovy ecosystem: with the Grails web framework ongoing growth, or the Gradle build automation system that is being used by Google for the building Android application.
There are different use cases for applying Groovy in your projects.
Groovy often gets introduced into companies and projects because of its rich testing tools it offers and how readable tests can become thanks to them, Laforge said. An example of this is the Spock testing framework. Other shops adopt Gradle for building complex applications where competing tools like Ant or Maven show weaknesses, he said. Moreover, Groovy is also often used for “scripting” or customizing applications through extension points featuring Groovy scripts.
In addition, the Internet of Things world is using Groovy for scripting home automation, for interacting with the various nodes of the mesh network, Laforge said. SmartThings and Carriots are integrating Groovy for that purpose.
Developers also can customize the Jenkins continuous integration platform with Groovy, or interact with the ElasticSearch search engine with a Groovy API, etc.
Laforge said some of the major uses of Groovy include:
· Google has moved the Android application build over to Gradle which uses Groovy as the build language, so all Android developers will soon be using Groovy for building their Android applications
· LinkedIn developed Glu — their open source deployment and monitoring platform — in Groovy, but they are also using Grails web applications for recruiters using the LinkedIn platform and profile database
· Various financial institutions like JPMorgan, MasterCard, Credit Suisse, Fanny Mae, Mutual of Omaha are using Groovy
· The European Patent Office is using Groovy for collecting patents from all over the world.
Asked what he and his team are doing with Groovy these days, Laforge replied: “These days, we are ironing out the latest details of the Groovy 2.2 final release. We are also working on future versions of Groovy at the same time, and investigating and experimenting with other areas where Groovy could offer some nice productivity boosts for developers. Think simplifying Android development, big data manipulation and analyses, etc.”