Groovy is a popular, open source, dynamic language residing on the Java Virtual Machine. Born in 2003, Groovy offers Java developers an almost-zero learning curve while gaining inspiration from Python, Ruby, and Smalltalk, according to its developers. Complementing it is the Grails open source Web application framework, which leverages Groovy.
InfoWorld Editor at Large Paul Krill recently spoke with Groovy project lead Guillaume Laforge and Grails project lead Graeme Rocher about what to expect in future versions.
InfoWorld: Why does Groovy exist?
Laforge: Initially, Groovy was created as a companion to Java, rather than as a replacement. The idea was to be able to simplify certain aspects of the Java language to make Java developers more productive.
InfoWorld: What are the main benefits of Groovy, and what differentiates Groovy from other languages, such as Ruby, Scala, Python, or Java itself?
Laforge: We wanted to complement Java by offering new features that were available from other languages, such as Ruby, Smalltalk, and Python. In terms of syntax and look and feel, it looks very much like Java. So it's very easy for Java developers to learn Groovy.
InfoWorld: What's the advantage of using Groovy instead of just using Java?
Laforge: You can make the code more expressive, for example, for defining your algorithms, whereas a language like Java is usually more verbal. So in terms of maintenance, because you spend more time reading your programs more than you spend writing them, it's even easier to read and maintain the code. And we bend the Java syntax to allow the creation of domain-specific languages. Because the syntax of Groovy is very flexible and you can write almost-plain-English sentences, business people are easily able to write business rules and domain concepts in a concise and very readable way.
InfoWorld: The latest version of Groovy was version 2.0, released in June. What are the principal improvements in it, and what improvements are planned for future versions and when might those arrive?
Laforge: There are essentially three big things in Groovy 2.0. Let's start with what I call the static theme. Groovy's nature is to be a dynamic language, but we also added new features, such as static type checking. We also built on that feature to do static compilation, which is about generating the same kind of bytecode as the Java C compiler. The net result is that you've got the same kind of type safety as you have with a language like Java, as well as the same speed as Java.
Typically, dynamic languages are slower than Java. But Groovy is very, very fast, thanks to those features, and they are safe to use for Java developers.
The second thing is around everything that happened in the Java language and in the Java development kits with Java 7 and JDK 7. [With] the syntax of Groovy being very close to Java, we added the same kind of syntax enhancements that were added to Java 7.
There's also another aspect related to the JDK and especially the Java Virtual Machine, which is the support of invokedynamic. Invokedynamic is a new bytecode instruction at the JVM level as well as a set of APIs, which have been created especially for the support of dynamic languages.
The last thing is about modularity: We made Groovy more modular.
InfoWorld: What improvements are going to be in Groovy in the future?
Laforge: In Groovy 2.1, we will be finishing work around invokedynamic support to completely use all the aspects of the invokedynamic bytecode instruction as well as the various APIs to further improve the performance of all the dynamic aspects of the language. We are also going to continue improving the support at the language level. It's going to be available in a couple of months or so, definitely before the end of the year.
InfoWorld: What is going to be in Groovy 3.0, and when would that be out?
Laforge: Groovy 3.0 will be released in probably about a year. We are going to rework the dynamic core of Groovy to completely review and rework the APIs, which are used for all the dynamic aspects of the language to further benefit from the invokedynamic support and to bring Groovy forward in the next phase. Also, we are bootstrapping Groovy by writing more of Groovy in Groovy.
InfoWorld: I was looking at a news article from about 2008 that raised the notion of Groovy overtaking Java on the Java Virtual Machine. Do you see that ever happening?
Laforge: Java will stay the dominant language on the JVM platform. That's my view, at least.
InfoWorld: What's the future for Grails?
Rocher: We are working on the 2.x chain of releases for Grails. At the end of last year, we released Grails 2, which is a pretty significant release, incorporating a new systems API. A couple months ago, we released 2.1, which adds integration with the Maven build tool. And then we're about to put out the release candidate for 2.2, in which you can embed different Grails applications within another application.
We're looking at Grails 3 into next year, which we're planning on moving to Gradle as the build system and implementing more advanced support for Web services to better support the creation of single-page Web applications
This story, "Groovy: The roadmap for the popular JVM language," was originally published at InfoWorld.com. Follow the latest developments in programming at InfoWorld.com. For the latest developments in business technology news, follow InfoWorld.com on Twitter.
Read more about application development in InfoWorld's Application Development Channel.