Posts tagged “Groovy“

Groovy variable scope is a massive game of Nomic

2013-10-20 in groovy java
Not my favourite programming language

At first glance, Groovy’s scope rules are much like Java’s. A variable name will refer to a local variable, a variable from a containing scope, or the superclass or -interface of a class scope, or possibly from static imports. Except in contrived cases, the system is fairly easy to reason about, and in any case the compiler will catch you if you do something wrong.

Groovy, of course, had to take a decent system and try to make it more “dynamic”. In some ways, the scoping system is more like Python, especially in that variable existence is determined partially at run-time. Python’s rules, however, are fairly simple, and make that system basically work.

Groovy identifiers play by the rules of Cavinball

2013-10-13 in groovy gradle java
Wat

Today, we’ll be talking about how Groovy doesn’t seem to have a consistent idea of what an identifier is. It’s not a very large topic, and it really isn’t a problem, but it is a topic that nevertheless merits mention, and it allows me to introduce…

Hello, world! A first look at Groovy

2013-10-06 in groovy java
Real programmers don't use `println`

The first look at any programming language often begins with the traditional “hello world” program. Below is Java’s, for reference.

HelloWorld.java

1 public class HelloWorld {
2   public static void main(String args[]) {
3     System.out.println("hello world");
4   }
5 }

Groovy’s, on the other hand, looks like this:

HelloWorld.groovy

1 class HelloWorld {
2   static def main(args) {
3     println("hello world")
4   }
5 }

Groovy: The Defective "Swiss Army Hammer"

2013-10-06 in groovy grails gradle java

Gr- — (Javanese) Agglunative prefix, typically indicating expectation of a painful experience, often due to lack of forethought or impropper planning.

Example constructs include:

  • Groovy — Adjective. Characterised by a large number of hacks attempting to make things better, but which really only increase the number of problems by an order of magnitude. “That’s some groovy code you’ve got there. I especially like how it uses the query parameters to dynamically select the class and static method to execute.”

  • Grail(s) — Verb (almost always found in the singular present). To inflict suffering and confusion by means of unnecessary complexity, self contradiction, and annoying surprises separated by excrutiating waits. “It really grails me how this ‘convention over configuration’ framework requires three multi-thousand-line configuration files to run.”

  • Gradle — Noun. An obstensibly comfortable, metaphorical location in which something is cradled before finally succumbing to death. “After having been in gradle for a few months, we found that the code had become impossible to update, due to library version conflicts.”