Tuesday, June 01, 2010

Power of Groovy and Grails

I recently started learning Groovy and Grails. I found it to be quite productive compared to traditional Java based web development.

Groovy itself is much more compact than Java, and it plays really well with Java. You can call a Groovy class from Java or a Java class from Groovy. Groovy is also a supported language on the Java platform via JSR #241.

For example, to read a file in Groovy, you just need to write the following:
new File("filename").eachLine{line-> println line}

Note the use of closure being passed to the eachLine() method.

If you do web development using Java, you are probably aware of the build-restart-test cycle that you have to go through for every change. You can setup hot deployment to work around it, but it is complex and doesn't always work that well. Groovy and Grails eliminate this inefficiency, as you can make a change and refresh the browser to see your change. (I have seen some complex changes to break in Grails as well, but I am hopeful that it will get better as this platform matures.)

Grails also comes with a number of plug-ins, which make most common tasks really trivial.

Using the power of Grails and Groovy, I was able to quickly setup 3pundits.com.

3pundits.com is an attempt to provide education related information to parents, students and teachers. More services are coming soon.

Do you use Groovy or Grails? What has been your experience?