Hacker News new | ask | show | jobs
by vorg 3901 days ago
I've found Groovy's only good for dynamically typed code...

* the stuff you want to write quickly but don't mind it running slowly, i.e. throwaway code

* the small stuff you know won't become a larger system one day, e.g. 30-line Gradle build scripts and code testing Java classes

* when you know you won't be upgrading to Java 8, which Groovy hasn't kept up with syntactically

Groovy's static compilation was tacked on for version 2.0 and doesn't work, except for sprinkling the occasional @CompileStatic around your code in a trial and error fashion. You didn't actually say you HAD started a new statically typed project in Groovy on the Java platform. If you do, use Java 8 which makes much of what Groovy brought to Java 7 redundant, or another language written from the ground up for static compilation, e.g. Scala or Kotlin.

In fact, I've found even for code testing Java classes, using Clojure is more productive than Groovy once you get over the syntax hurdle because macros can eliminate verbosity in repetitious test scripts in a way functions can't.