Last week was the European GR8 Conference for Groovy, Grails, Griffon, and other GR8 technologies. Besides sending four attendees, Canoo had two speakers: Andres Almiray for “Flying with Griffon” and Hamlet D’Arcy for “Code Generation in Groovy“. As if that weren’t enough, Canoo also sponsored a Hackergarten night, where patches to Groovy, Grails, Griffon, and Gradle were all created. At the end of the event, a few of us Canooies got together and wrote about our favorite parts, the parts that impressed us most.
Detlef Brendle
Spock – Smarter Testing with Spock by Peter Niederwieser
Peter presented the Spock framework. Inspired by Junit and other testing framework, Spock brings the strength of Groovy into testing. A groovy DSL let testcases be more human readable and can even help in discussions with non-techie project members such as business analysts or managers. Data-driven test specifications let developers inject a data table (loaded from any data source such as an excel file, a db table or others) into tests in order to separate the test from its data. Spock testcases are Junit tests and therefore nothing special needs to be done within the IDE or within the CI build system. If a testcase fails Spock provides a much better reporting output than Junit. It gives a developer hints what have went wrong. Conclusion:
Detlef
Gradle – A better way to Build by Hans Dockter
Hans talked about its baby Gradle and how Gradle can help to ease the build system of any Java Project. The strength of Gradle is its declarative way of defining the ‘What’ to do in order to build and leave the ‘How’ to the build system itself. Even things like task dependencies (e.g. to execute Tests the sources must have been built before) are left to Gradle. Parallel Test execution is also a built-in feature. This will soon be extended to parallel build execution for multi project builds.
Conclusion : It is definately something to keep in mind when thinking about changing its own build setup.
Sven
Groovy: to Infinity and Beyond! by Guillaume Laforge
Guillaume presented the most interesting bits in the evolution of Groovy from version 1.5 up to the current 1.7.x and what they would like to put in the future versions of Groovy. Especially for Groovy newbies it was interesting to see what Groovy provided in it’s first version like generated getters and setters for bean properties and how each version provided new value such as support for Java 5 features like annotations, generics and enums in Groovy 1.5 for example. AST transformations such as @Immutable and @Delegate, parallel assignments, Grape and improved performance in 1.6, 1.7 brought anonymous inner and nested classes, power asserts and ASTBuilder.
One of the latest additions is that annotations can take a closure as argument laying the foundation for fantastic things like gcontract, Design by Contract (TM) for Groovy, which rose big interest. Unfortunately there was no exclusive session about gcontract, but Hamlet D’Arcy came to the rescue and explained the most important things about it in his very interesting and enjoyable sesssion ‘Groovy Compiler Metaprogramming’. Guillaume also gave an outlook about potential new features in version 1.8 such as annotations beyond Java 5, structural pattern matching and parser combinators. The intersting thing I found was when we discovered that ‘withDefault()’ of a Map actually modifies the map even when it is made immutable:
def m = [:].withDefault { k -> ‘default’}.asImmutable()
assert m.size() == 0
m.get(1)
assert m.size() == 1
As someone relatively new to groovy I find AST transformations extremely intersting and will definitely write one at the next Hackergarten event in Basel.
Groovy on the way to success (Philippe Delebarre, Raffaele Cigni, European Patent Office)
In the keynote Philippe and Raffaele gave an overview on how the European Patent Office works and explained the difficulties of processing 140′000 patent applications per year. Since patent applications have a rather unstructured format it is very challenging to process them in an automated way. Currently this is done by a legacy system mainly consisting of HOST components and REXX scripts.
Two attempts to migrate the old system with a new one failed. The latest attempt with a so called Data Flow Platform, a process server, was sucessful. With DFP and openrules business rules are implemented using a groovy based DSL. This is done by a business person together with a developer based upon the users’s and the business’s needs.
An eye opener for me was how a business oriented DSL opens up completely new perspectives on pair programming and thus can contribute so much to the success of a project. In this project this was the way to bring Business and IT in direct contact which is so difficult in many larger companies. Philippe and Raffaele made the experience that this led to a much faster development cycle and in addition they rose the interest of other business domains in the European Patent Office to use this approach.
Sven – Hackergarten
My Hackergarten part:
Hackergarten: Devloping a PMD plugin for gradle
With Hans Dockter, the gradle expert our team had the perfect foundation to takle this goal. We decided to go forward in small steps. Since we knew there was a ant task for pmd we started with a small tiny gradle script with one task that used the ant builder to call the pmd ant task. This sounds simple but it turned out to be not. To use pmd we needed to put a dependency on it in the gradle script. This caused to download many many jars on which pmd seems to depend on and which also caused ClassCastExceptions due to classloader conflicts.
After having resolved them Hans showed us how to bring this functionality in the form of a plugin by putting it in it’s own file(s). Then we added the most important pmd features just by looking at what the pmd ant task provides.
The current state is almost ready to be released. Hans still needed to make a change on handling filesets. The next step is to get rid of the ant builder usage and rather use the PMD api directly, most likely by looking at how the ant task is implemented.
In the middle of our development work we learned that Rene Gröschke had already developed a findbugs and pmd plugin for grade a week. We contacted him and will merge the two versions.
For me it was a great pleasure to work in this team in the Hackergarten because it was so productive. Everyone could contribute and learn at the same time.

Detlef Brendle
Peter presented the Spock Framework. Inspired by Junit and other testing framework, Spock brings the strength of Groovy into testing. A groovy DSL lets test cases be more human readable and more structured. It can even help in discussions with non-techie project members such as business analysts or managers. Also, data-driven test specifications let developers inject a data table (loaded from any data source such as an excel file, a db table or others) into tests in order to separate the test from its data. Spock testcases are Junit tests and therefore nothing special needs to be done within the IDE or within the CI build system. If a test case fails Spock provides a much better reporting output than Junit. It gives a developer hints what have went wrong. Conclusion: The Spock Framework is something to consider on our next project.

Sven Ehrke
Guillaume presented the most interesting bits in the evolution of Groovy from version 1.5 up to the current 1.7.x and what they would like to put in the future versions of Groovy. Especially for Groovy newbies it was interesting to see what Groovy provided in it’s first version like generated getters and setters for bean properties and how each version provided new value such as support for Java 5 features like annotations, generics and enums in Groovy 1.5. Then in 1.6 we got AST transformations such as @Immutable and @Delegate, parallel assignments, Grape and improved performance. 1.7 brought anonymous inner and nested classes, power asserts and ASTBuilder.
One of the latest additions is that annotations can take a closure as argument laying the foundation for fantastic things like GContracts, Design by Contract (TM) for Groovy, which arose big interest. Unfortunately there was no exclusive session about gcontract, but Hamlet D’Arcy came to the rescue and explained the most important things about it in his very interesting and enjoyable sesssion ‘Groovy Code Generation’. Guillaume also gave an outlook about potential new features in version 1.8 such as annotations beyond Java 5, structural pattern matching and parser combinators. The intersting thing I found was when we discovered that ‘withDefault()’ of a Map actually modifies the map even when it is made immutable:
def m = [:].withDefault { k -> 'default'}.asImmutable()
assert m.size() == 0
m.get(1)
assert m.size() == 1
Also, as someone relatively new to groovy I find AST transformations extremely intersting and will definitely write one at the next Hackergarten event in Basel.

Hamlet D'Arcy
Mr. Haki, aka Hubert K. Ikkink, stood in front of the audience for a 90 minute live coding session that wowed everyone. I filled a page of my notebook with new Groovy idioms that I did not know existed. For example, did you know you can use Lists as a replacement for constructors:
URL url = ['http', 'www.mrhaki.com', 80, '/'] as URL
Me neither! I had quite a few new tidbits like these as well.
It’s great to see a live coding session and Mr. Haki did it with almost no written notes. Bravo. As a Groovy developer, the Groovy Goodness blog is a great resource that I use all the time for reference. It was fun and informative to see it live.

Detlef Brendle
Hans talked about his baby Gradle and how Gradle can help to ease the build system of any Java Project. The strength of Gradle is its declarative way of defining the ‘What’ to do in order to build and leave the ‘How’ to the build system itself. Even things like task dependencies (e.g. to execute Tests the sources must have been built before) are left to Gradle. Parallel Test execution is also a built-in feature. This will soon be extended to parallel build execution for multi project builds.
Build system sessions can sometimes be boring, but Hans spent nearly all the session writing build scripts live, showing how quickly new build requirements can be incorporated into an existing build. His focus was on showing how a rich project domain model and a good front end scripting language enable you to get the build you need, not the build some other team has dictated to you.
Conclusion : It is definately something to keep in mind when thinking about changing to a new build tool.

Sven Ehrke
In the keynote Philippe and Raffaele gave an overview on how the European Patent Office works and explained the difficulties of processing 140,000 patent applications per year. Since patent applications have an unstructured format it is very challenging to process them in an automated way. Currently this is done by a legacy system mainly consisting of HOST components and REXX scripts. Two attempts to migrate the old system with a new one failed. The latest attempt with a so called Data Flow Platform, a process server, was sucessful. With DFP and openrules business rules are implemented using a groovy based DSL. This is done by a business person together with a developer based upon the users’s and the business’s needs.
An eye opener for me was how a business oriented DSL opens up completely new perspectives on pair programming (a BA and a developer pairing together) and thus can contribute so much to the success of a project. In this project this was the way to bring Business and IT in direct contact which is so difficult in many larger companies. Philippe and Raffaele made the experience that this led to a much faster development cycle and in addition they rose the interest of other business domains in the European Patent Office to use this approach.

Hamlet D'Arcy
If you think including a co-worker’s Grails-like RIA framework session in the “best of” wrap up is unfair, then you must not have seen the session! Andres built a full Twitter client live starting with nothing and using only Griffon and the standard plugins. It was runnable as an applet, a JNLP webstart, or a traditional desktop application. It had a rich data grid that competes evenly with the FlashVM alternatives, and the business/component widgets are top notch.
The time when Griffon really impressed was during the extended question and answer. Every question was answered with a “yes, there is a plugin for that” and a live demo. Need an executable installer or a Mac .dmg file? Andes typed:
griffon install-plugin installer
to install the functionality. Want to use CSS styling in your components?
griffon install-plugin css-builder
The best part was the email he sent live with 5 minutes left in the presentation announcing the release of Griffon 0.3.1. I knew Andres was up late the night before hacking Griffon code, but that isn’t unusual. To see a software release live on stage was a complete surprise. Good job, Andres.