I’m about six weeks in to what has turned out to be a medium-sized project, and I’m hating the thought of my next Java project. Why? Because this project is in Grails and it has been such a joy to work with, it will be downright painful to do a classic Java / Spring MVC application again.
This is my third project using Grails. Each project has given me a chance to dig deeper in to the framework. The first project was more as an observer/reviewer and I wasn’t impressed with the outcome. The second project was me writing the code, and it started to click. Now, on the third project, I’m really starting to appreciate the framework.
So why does Grails rock? Here’s a few of the key things I would have a hard time dealing without.
- GORM makes database access infinitely simpler than any of the Java alternatives out there. It is simple to create new domain classes, and also to map to existing databases.
- Validation is dirt simple. I’m using a few custom flyweight objects for a tricky page, and by adding a simple
@Validateableannotation to the class I can make use of a constraints block on my own class. And it ties in with the error messages.
- Thanks to the Grails command line, development is super fast. Make changes and they appear immediately. There is no twiddling your fingers waiting on a Maven build script.
- The included taglib is actually pretty comprehensive. I still have a fair bit of custom JQuery code, but even it very cleanly ties in to the Grails controllers for AJAX calls.
My only pain with Grails has been the same one that has vexed Java developers for a decade: the
java.util.Date class. This class remains a steaming pile, even wrapped in Groovy goodness. But the solution to this problem is one plugin away. Every sane Grails developer should be using the Joda Time plugin to handle dates.
So Grails is my new shizzle. I plan on using it at the next hackathon, and hopefully will use it for my next project. Any Java developer that hasn’t taken a look at Grails 2.0 really needs to give it a glance and see what they’re missing.