Another scripting language that people seem to like is Groovy and there is now a Rails-like framework for Groovy called, unsurprisingly, Grails. Derek Perez likes Groovy and has asked me several times to add support for Groovy to my Scripting for ColdFusion 8 project. Raffaele Castagno, an Italian Groovy fan, even sent me custom tags and instructions for adding it to the project back in August last year but I never got around to it. Then Dave Ross said the other night that he thought Grails was going to do very well for Java developers who don't like Ruby's syntax. Since that was my main objection, I figured it was a good time to actually look at Grails.
The Grails site has a simple installation page with two options: download and install or install from Subversion. The latter sounded like fun for a Sunday afternoon so I checked the code out from codehaus.org and typed ant. 17 minutes later, I had a pristine installation of Grails from the head of SVN. Time to write my first Grails app!
The Grails site also has a simple Quick Start: grails create-app, grails create-domain-class, grails create-controller. A couple of small edits to the generated code and then fire up Grails and run the app in the browser. It all went very smoothly, exactly as the Quick Start showed.
The first thing that struck me about the running example - after seeing the Rails scaffolding and the Model-Glue scaffolding - is just how pretty the default scaffolding is! Nicely styled output (with CSS), icons for create / edit / delete, a sortable list view (the screencasts on the Grails site were clearly made with an earlier, less sophisticated, version of the scaffolding).
The syntax is definitely cleaner than Ruby (in my opinion) and the structure of the application feels very Java-like and, thus, more familiar to me than the Rails approach. It's probably nice enough that I might actually continue playing with Grails (unlike my experience with Rails).
There are tutorials on integrating Grails with Hibernate and Spring, which will also be more of a match to what I'm used to in ColdFusion (with Transfer and ColdSpring at the heart of all my projects). You can easily create a WAR for deployment of the (compiled) application to a Java app server (technically any Servlet container) so, in theory, you can deploy Grails apps to a JRun instance to run alongside ColdFusion.
1. Groovy syntax is more java like. I prefer it to Ruby.
2. Groovy can take advantage of existing java code. You can do this with JRuby as well but I don't know if the integration is as good.
3. With you Grails and jetty you supposedly can get pretty close to the "hot deploy" features that CF developers expect. You can update a groovy file and then hit reload in your browser and the changes are there. No more worrying about class loading.
Another things I like about Grails is it is powered by Hibernate and Spring verses Rails with uses ActiveRecord.
I think the integration with Java is still a lot better than JRuby, but from what I know, the JRuby guys are trying to make that the number one priority (or, I could be a release behind on that - so much information comes through my reader now that I find it hard to remember timing information)
I'm looking forward to seeing great things happen with Groovy, in any case.
Groovy makes the stress that comes with Java programming subside quite a bit (especially for CF programmers who have dabbled with Java). GroovyBuilders and the MOP layer alone make it worth the look.
As far as a framework, Grails has a great ORM tool called GORM which is a Groovy wrapper for Hibernate making Hibernate a lot easier to use. There is also a growing plugin community that have produced some amazing tools to make JEE integration extremely easy; check out the JMS plugin to see how easy its gotten. Additionally, someone has even released a Flex plugin for Grails that makes bundling Grails and Flex into a WAR just as simple as typing "grails war".
Groovy and Grails are definitely worth exploring, IMO. JRuby on Rails is great to work with, but the JEE integration support is no where near what Grails promises to deliver which is really important to me.
But yeah, it'll be interested to see what happens with Groovy.
As for Ruby verus ColdFusion, well, this chart is a little telling...
http://www.indeed.com/jobtrends?q=%22cold+fusion%22+or+coldfusion%2C+ruby&l=
http://www.indeed.com/jobtrends?q=java%2C+coldfusion+or+%22cold+fusion%22%2C+perl&l=&relative=1
That shows that the job markets for Java, Perl and ColdFusion are all pretty stable (as expected - they're all mature, stable technologies).
That shows the "new" scripting languages are all growing compared to Perl and that Python, Ruby and Groovy are all outstripping PHP in terms of growth, with a huge spurt of Groovy/Grails popularity recently. Again, no surprises there. The "new kids" are still growing into their market - because they're new.
That shows that Perl is still far, far, more popular than the other scripting languages, even PHP. Again, no surprises - Perl is a mature, stable technology.
seancorfield on AIM/Gtalk(@gmail.com)/MSN(@hotmail.com)/Skype/YIM
I've been pretty impressed by what I've seen out of the Rails community. Ruby's syntax is definitely "take it or leave it", although I must say I like the terseness and flexibility of the language.
I was a little sad when LeGros's foray in to Grails didn't pan out the way we had hoped, since the learning curve would have been shorter for our web team to pick up than it will be for Ruby (after all, we're primarily a Java shop). However, having seen the current state of the JRuby implementation I'm certainly not disappointed that we're going to be leaving CF for it.
- max
Are you still considering adding Groovy support?
If so, do you think it will work better, similar, or worse than the CFGroovy project?
Thanks!


