Early this week I pestered Dierk Koenig into letting me ask him a few questions about Groovy past and present and the upcoming release of Groovy in Action 2nd Edition. If you aren’t aware already, Dierk is the author of Groovy in Action, a Canoo Fellow, and a Groovy, Grails and GPars committer.
Hamlet: The original Groovy in Action was published almost 4 years ago using (I believe) Groovy 1.0, and the 2nd Edition of the book is scheduled next year to coincide with the 1.8 release. What are the biggest productivity improvements between Groovy today and that of 4 years ago?
Dierk: Well, there are so many cool developments that I hardly now where to start, and in the end I will probably end up forgetting the most important one. Anyway, I will try.
One of the most important features is backward compatibility. I think the Groovy team has done a very good job in advancing the language without introducing breaking changes.
For me, it is often the small changes that make a big difference like “power assert“. A newcomer may dismiss this as a minor thing but it is of ubiquitous use, beside showing the language power of Groovy. I could mention many more improvements: the completion of the GDK, Mixins, more Metaprogramming options, command expressions, the Grape packaging system, and so on, but two features make the biggest difference in productivity for me: AST Transformations and IDE support.
AST Transformations use annotations to demarcate classes, methods, properties, and the likes in order to
achieve an enriched compilation. You want your class to be immutable? Simply give it the @Immutable annotation and you have all the goodness. There are endless possibilities with this approach and it comes without runtime costs!
IDE support has evolved far beyond what I ever thought possible for a dynamic language. Code completion for dynamically added methods? Yes, that’s possible! And even though the Groovy compiler has no need for type inference, the IDEs can give code completion on inferred types. Cross-language refactoring? Done. And the list goes on…
Hamlet: In 2007 Groovy won the JAX Innovation award. Is Groovy still a leader in JVM innovation?
Dierk: Looking into the roadmap for Java 7 and 8, it is pretty obvious that many developers have fallen in love with Groovy features and this forces Java to provide equivalents for at least a subset. Groovy has become and still is a pioneer for Java language features, simply because we strive for language features that make us more productive while keeping the solution Java-friendly.
Hamlet: James Gosling wrote a famous paper called “The Feel of Java” in which he described Java not in terms of language features but in terms of a general mindset and philosophy. You’ve been involved with Groovy since almost the beginning. What is the “Feel of Groovy” and has it changed in the 7 years the language has been alive?
Dierk: There are two sides to this: the user view and the developer view.
As a user of the Groovy language, I would say that Groovy still feels as groovy as in the early days. The important points are:
- Groovy is dynamic (that’s the nature)
- Groovy is feature-rich (that’s where the fun comes from)
- Groovy is Java-friendly (hence easy to use)
Groovy always was and still is a “getting things done” language. It is pragmatic – as opposed to being dogmatic about language design theory.
For a developer, the feel of Groovy has changed. The early days were a bit of a wild-west but since version 1.0 (and not coincidentally the release of Groovy in Action) we feel a high obligation to evolve the language in a controlled fashion. In my perception, Groovy has become the de-facto industry standard for dynamic programming on the JVM and many projects and organisations rely on it.
Hamlet: Lastly, I see that readers can already download parts of Groovy in Action 2nd Edition from Manning’s MEAP program. Is the MEAP complete enough to be useful today or Groovy newcomers stick to reading the 1st edition for now?
Dierk: The first edition is still fully valid and for the sake of completeness I would advice newcomers to go with it. You can always buy the second edition later. Honestly, computer books are ridiculously cheap, especially if you compare it against the price-tag for the invested reading time (not even mentioning the invested writing time).
Hamlet: Thanks Dierk!
Dierk: My pleasure!
You can catch Dierk at the upcoming W-JAX conference this November in Münich. He will talk about parallel processing with Groovy, advantages and limitations of dynamic programming as well as about the Canoo RIA Suite.