1st day at Grails Exchange

Here I am in London attending my first day at the Grails Exchange. Unfortunately I missed the keynote from Guillaume LaForge and Graeme Rocher this morning because I took a late train from Paris. Not because I wanted to sleep more, but I just managed to enrol yesterday afternoon (thanks to Guillaume for his help on that). Difficult to find an earlier train with such a short notice.

The conference is held at the Barbican center in London. Good memories come back to me when I was living in London and coming here to listen to weird concerts. I arrived at the conference at 1pm, just in time for lunch. The atmosphere is pretty good. The food great. A fantastic indoor garden where you can have your meal. Not a lot of people, easy to meet and talk to everybody.

My first session is EJB 3 entities & Grails by Jason Rudolph. The talk is about the integration between JPA annotated POJOs and POGOs. Jason first started to reverse engineering an existing database with Hibernate tools to obtain JPA annotated POJOs (Knight ans Sword, he took some Monty Python example). After creating a grails app, he copied these two POJOs into it. Using the groovy shell he could use GORM features to access the data (eg. Knight.list() or Knight.findByNameLike(‘Sir%‘) and so on). Then Jason created a Castle POGO (Groovy bean) which has a Knight attribute (Knight is a POJO, still following me ?). He could then do things like knigh.caslte.sword (pojo.pogo.pojo). And it just works. That‘s really why I love Groovy, it integrates so well with Java and leverages some burdens of the Java language some times.

Grails in the enterprise environment byt Ismael Hery & Giles Laborderie. They started presenting the architecture of 3 different real life projects they worked on. Two mixing Java and Grails and one 100% Grails. In one architecture they took an existing Java application which had Struts/JSP/Service layer/DAO/Hibernate, got reed of Struts/JSP and changed it to Grails Controller/GSP/taglibs, they also used GORM. On another Java application they’ve used the web services capabilities of Grails. Later Ismael talked about agility with Grails and how agile the language is (delivering frequently, simplicity…). Ismael also talked about a topic I find really interesting, dynamic architecture. With Grails you can add your jars to the lib directory and that’s fine for the first iterations. Then you can add Maven, and then a continuous integration tools. Same thing for layering. You can start with just UI + GORM and then add a service layer (with DTOs created dynamically with the Expando). At the end Giles talked about how to use Grails from prototyping through industrialized application without throwing your code away. He ended the session with these two questions : is Grails ready for the enterprise and is the enterprise ready for grails…. the answers were yes. This session is really interesting for me as I‘m working on patterns to migrate Grails code to Java EE 5. To be followed…

Groovy for Java programmers by Jeff Brown. Well I was expecting a bit more in-depth talk about how Groovy code gets loaded by Java classloaders and so on. But it was an introduction to the Groovy language. Well, I still learned some stuff and Jeff is quite a good orator. He talked about the Groovy syntax, list, maps, range, POGO

Test driven development with Groovy & Grails by Jeff BrownJeff started this session saying that testing dynamic language is challenging… well, because lots of things are not known until runtime. On the other hand, some powerful Groovy feature will help you to test your Java classes. First of all, just to emphasis the integration between Java and Groovy, GroovyTestCase extends JUnit TestCase and adds more methods. Jeff shows how to test Java classes with Groovy. And there are some really powerful stuff. He took the example of isolation. If your Java class does any IO or network operation, how do you isolate your test to avoid those external call ? Well, depending on your needs, you can use Expendos of course, but Mock and Stub. I have to be honest, there was some pretty deep code with Stubs that I didn‘t get. Need to investigate more on that. Jeff also talked about the unit testing capabilities of Grails as well as the integration.

Now it‘s 7pm, I‘m sitting in the lounge ready to go home (well, to a friend‘s home) and come back tomorrow. I‘ll keep you inform.

Leave a Reply