I'm a big Groovy enthusiast, but I only use it myself for build/deploy scripts.

A real pro demonstrated Groovy's power last night:

Paul Woods ran us through 90 minutes of groovy features last night, and demonstrated how powerful the language can be in the hands of someone who works with it exclusively every day for a year.

It was stunning, really nice stuff. You can finish tasks in a couple lines of code that might take a page of code with Java. Paul builds ad-hoc reports in minutes using Groovy that might take others hours.

Not For Me:

Watching a real pro with Groovy, it only hardened my core beliefs about where to use this language. I would almost never use Groovy for my enterprise production code. Here's why.

  • It takes months to memorize all that shorthand. (per the presenter, and also per what I saw with my own eyes.)
  • You can't fall back on the compiler/IDE/typeahead to do your mindless thinking for you. That means you better unit test every piece of every call, or you might be very surprised at runtime.
  • I wouldn't trust normal corporate developers  to write good production Groovy code. The best and the brightest, no problem. Normal guys, not in my production code base...and include me in those normal developers at my current skill level with Groovy.

The first two above came directly from the presenter, not just my own impressions. The third is my own conclusion - and also the conclusion of a couple others that I walked out of the meeting with.

Is Groovy faster to write?

I've been using Groovy to do the oddball build/deploy tasks that are too wacky to do with Maven for years now, and for this, Groovy is excellent. Gant commands are especially nice - like being able to write conditional Ant tasks in a real language.

But it's so much faster for me to write my production code in Java that I can't even think about using Groovy for that. That's because I let Eclipse typeahead do most of my work for me. I type fast, but I'm very slow at stuff like remembering how to spell that variable name I created 45 seconds ago.

I typically type two characters of a variable or method and then [control] [space]....I never type the whole thing once a variable or method is established. My box is fast, the habit is reflexive, so it all happens before I can even think.

A big contributor to this problem is I prefer verbose code. That's a disability, probably. Verbose and overly obvious code is just one of my shortcomings, I'm sure.

Grails - worth these risks:

Having made the above statements, it's worth noting that I've created a few Grails apps too.

Grails apps aren't for every purpose, but I'd put up with a lot of the problems mentioned above to get the lift of a Grails app, under the right circumstances.

 


Setting Me Straight:

I'm not trying to be right here. This is my perspective, not reality.

Please feel free to flame me below, as this topic deserves a more rounded view.