Groovy-Based Agile Grails Learning
Here's my favorite bit about learning Grails, which I am doing in NetBeans IDE, via Jason Rudolph's brilliant "Getting Started with Grails" (I grabbed the free download here): I'm at the point on page 28 where we're creating "Meaningful Record Identifiers". In the Registration domain object, I'm told to add the line below:
class Registration {
//...
String toString(){"${this.name}:${this.emailAddress}"}
}So then I run my application and I see this, displaying data from a MySQL database (hooking it up to my application was so scarily simple, I may never want to do that in Java again):

However, and this is the point I'm trying to make here, I didn't like the separators between the name and the address. Instead of colons, I'd like to use braces. So in the IDE, I changed the semicolon to braces, as you can see here in line 22:

Then... I saved the file. And after that, did I redeploy my application? No! I simply refreshed the browser and saw the result immediately:
Can you imagine what that means for learning Grails? Really speeds things up immensely. When you're working with constraints and scaffolding, for example, you simply add a new constraint, save the file, quickly refresh the browser and then... you immediately have a new widget in your application. One can therefore genuinely learn Grails while doing other things. I.e., you can learn it on the fly, in between other work you might be doing, because everything is so fast and immediate. That's probably old news to the Groovy community, but definitely new news to those outside of it. At the very least, that's new news to me.
| Attachment | Size |
|---|---|
| racetrack-grails-2.png | 60.35 KB |
| racetrack-grails-1.png | 58.97 KB |
| racetrack-grails-4.png | 93.45 KB |
- Login or register to post comments
- 1131 reads
- Flag as offensive
- Email this Story
- Printer-friendly version
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)







Comments
Raphael M replied on Tue, 2008/07/22 - 11:35am
In my job I do most Spring/Hibernate/JPA/Struts2 work and I have a little background with java frameworks. I agree with you. Using Grails for the first time is a big cultural impact as going from a JSP with JDBC connections to a full-stack MVC architecture.
It's like someone had the same problems I face everyday and solved them by adding another layer of abstraction. Genius.
Fred Grott replied on Mon, 2008/07/28 - 6:15am