โฏ Guillaume Laforge

Dsl

SpringOne2GX Groovy presentations aftermath

Last week, I was in Washington DC for the SpringOne2GX conference.

I’ve had the pleasure of presenting twice: first time on an update on Groovy 2.0 (and a recap on key features of Groovy 1.8), and a second time with my friends and colleagues Paul King (Groovy core committer) and Andrew Eisenberg (Groovy/Grails Eclipse tooling lead) about Domain-Specific Languages in Groovy.

Please see the slides published below:






Groovy Domain-Specific Languages in Chicago

With my friend Paul King, we ran our Groovy Domain-Specific Languages talk again this year in Chicago, for the SpringOne2GX conference. I’ve uploaded the slides on Slideshare, and Paul has pushed the examples on Github. The room was packed, and we had lots of fun doing our little dialogue between the customer and Groovy DSL developer, improving our DSLs, showing new techniques along the way, to suit the requirements as they evolved.




Groovy AST transformations tutorials

Groovy is a powerful language that gives the opportunity to its users to plugin into the compilation process to create what we call AST transformations, ie. the ability to customize the Abstract Syntax Tree representing your programs before the compiler walks this tree to generate Java bytecode.

Since Groovy 1.6, many useful such transformations have been added to Groovy, like @Delegate to implement delegation, @Immutable to make your types immutable, or @Grab to add dependencies to your scripts, and many more. However, mastering the Groovy AST and compiler APIs is not such a simple task, and requires some advanced knowledge of the inner workings of Groovy.

Read more...

Nicer DSLs in Groovy 1.8 thanks to Extended Command Expressions

A quick heads-up to tell you about an upcoming Groovy 1.8 feature which will allow us to make nicer DSLs. This feature will be available in Groovy 1.8-beta-2, which will probably be released before JavaOne.

Lidia Donajczyk was our Google Summer of Code student this year, working on the implementation of GEP-3, an extension to Groovy’s command expressions. You can have a look at the GEP-3 page for the guiding ideas behind this enhancement proposal.

Read more...

Meeting Neil Armstrong and speaking of Groovy and Grails

I had the pleasure to participate in OCTO’s IT University (Universitรฉ du SI in French) a couple weeks ago. The conference was really great, and I think France really needed such a high-quality IT event as there was no real good event like that until now. So big kudos to the organizers.

Apart from great food, excellent speakers covering interesting topics, I had the pleasure of spending time with my friends from the OSSGTP community (Vincent, Guillaume, Patrick, Mag, Didier, Fabrice, Erwan), with my former colleagues, and with some great guys like Ross Mason, Erik Meijer (with great tshirts as usual), and more. But perhaps the most impressive, interesting and emotional-heavy moment of the conference was the closing keynote by astronaut Neil Armstrong, as featured on the picture on the side. This man is so humble, interesting, funny, elegant, that everybody really enjoyed listening to him speaking about the space conquest, distilling some nice and funny anecdotes and making parallels with IT, the story of computers, etc. Awesome! It was such a big honnor to have him there!

Read more...

A Domain-Specific Language for unit manipulations

Domain-Specific Languages are a hot topic, and have been popularized by languages like Groovy and Ruby thanks to their malleable syntax which make them a great fit for this purpose. In particular, Groovy allows you to create internal DSLs: business languages hosted by Groovy. In a recent research work, Tiago Antรฃo has decided to use Groovy to model the resistance to drugs against the Malaria disease. In two blog posts, Tiago explains some of the tactics he used, and how to put them together to create a mini-language for health related studies. In this work, he needed to represent quantities of medecine, like 300 miligram of Chloroquinine, a drug used against Malaria. Groovy lets you add properties to numbers, and you can represent such quantities with just 300.mg. Inspired by this idea, the purpose of this article is to examine how to build a mini-DSL for manipulating measures and units by leveraging the JScience library.

Read more...

From named-parameters to Domain-Specific Languages

There have always been a few irritating things to me in Java. However, working on Groovy made me go beyond these limitations, or all the useless boiler-plate code one has to write. If I had to ask for some new features in Java 7, that would certainly be:

  • have closure support (or delegate or whatever you call that)
  • native syntax for common data structures like lists and maps
  • named parameters

Today, I’m going to say a few words about the last item on my list: named parameters.

Read more...