Over a million developers have joined DZone.

Groovy-Based Agile Grails Learning

DZone's Guide to

Groovy-Based Agile Grails Learning

· Java Zone ·
Free Resource

"I love writing authentication and authorization code." ~ No Developer Ever. Try Okta Instead.

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.


"I love writing authentication and authorization code." ~ No Developer Ever. Try Okta Instead.


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}