

Consuming Web APIs with Groovy - rmangi
http://www.getspun.com/consuming-web-apis-with-groovy/

======
vorg
> We use Groovy a lot at SPUN and we love it. Our CMS is written in grails and
> our feed consumption “sponge” is Groovy + Jetty and GPars with a frontend
> written in KnockoutJS. What I like most about groovy is that it builds on
> the existing Java ecosystem and, being so close to Java, new developers can
> learn it in no time. Once you get into the new features that Groovy brings
> to the table it really makes coding a lot more fun, but you can learn those
> features over time while still being productive with your existing Java
> chops.

What new features are these? Static compilation is hardly production ready, as
seen by this bug in Groovy 2.1.0 reported only last week...
[http://stackoverflow.com/questions/14774709/groovy-2-1-0-wei...](http://stackoverflow.com/questions/14774709/groovy-2-1-0-weird-
behaviour-of-switch-case-break-statement-with-compilestatic)

Groovy's static compilation came with Groovy 2.0. Although officially released
in June 2012, it _really wasn't released for production use until it was
bundled as part of Grails_ 2.2 in Dec 2012. The 6 months from June to December
was unofficially _just more beta-testing_ with a larger base of users, those
who download standalone releases of Groovy. Grails, however, doesn't use any
of the static compilation features in Groovy 2.0. All the testing of Groovy
2.0 was just to make sure the inclusion of static compilation in Groovy
_didn't break any of its dynamic compilation use in Grails_.

Maybe the new feature in Groovy 2 you're talking about is invoke-dynamic. In
both Groovy 2.0 and 2.1, the code using invoke-dynamic is bundled in a
separate jar-file which only runs on Java 7. Grails and Gradle don't bundle
this other invoke-dynamic jar file, and don't intend to for Grails 2.3 and
Groovy 2.1 either. Whereas the legacy stream of Groovy can be tested to see
that the static compilation doesn't break the preexisting dynamic compilation,
the invoke-dynamic jar needs far more testing because it would actually
replace the existing dynamic-compilation codebase, so Grails and Gradle won't
bundle it.

You're just a patsy of the Groovy/Grails project management pitching for
Groovy 2.1 beta-testers for Grails 2.3 when you write in your blog: "Once you
get into the new features that Groovy brings to the table it really makes
coding a lot more fun, but you can learn those features over time while still
being productive with your existing Java chops."

If you really want static compilation, use Scala which has been battle-tested
far longer than Groovy's. If you really want invoke dynamic, use JRuby which
bundled it even _before_ Java 7 was released. Groovy is really only useful if
you use Grails, and for quick testing scripts - quick to write but slow to
run, that is.

~~~
rmangi
When I said "new features" I meant the core language features of groovy
(closures, etc.) not static compilation. If speed is really that important to
you, sure scala is faster today, but groovy will catch up very soon.

~~~
vorg
> If speed is really that important to you, sure scala is faster today, but
> groovy will catch up very soon.

I didn't mention anything about speed. I talked about being _free of bugs_.
Scala is more stable than Groovy' static compilation, having been battle-
tested for much longer. I doubt Groovy's static mode will ever be more
reliable than Scala.

