Live with grace. Write superb software.

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; GeSHi has a deprecated constructor in /var/www/blog/plugins/content/geshi/geshi/geshi.php on line 262

The reason why I love groovy, is because the language is not only easy to master if you already know Java, but also since it has beautiful ideas behind it.

Groovy is the very first language that made me consider every single bracket pair as a closure, and to feel it should be natural to send them around, and that for, do/while and while constructs are just words with a special meaning and syntax for the compiler that receive closures as arguments. (In groovy if the last parameter is a closure it is not necessary to be inside the parenthesis of the method, thus:)

callSomething(a, b, { a == b })

is actually equivalent to:

callSomething(a, b) { a == b }

Thus here is a "while" implementation, done in Groovy.

def myWhile = { condition, closure ->
    for(;;) {

Note that since the condition also must be a closure, I must use brackets inside the parameter:

int i = 0;
myWhile({i < 5}) {
    println i
println "finished"

will output:


Think on how this would look on JavaScript:

myWhile(function() {return i < 5}, function() {

or worse in Python:

def callCode():
    print i
myWhile((lambda i : i < 5), callCode);

Only the groovy version is elegant, simple and powerful. Looks like its an integral part of the language.

This is why I am not a big fan of the new closure syntax they will bring in Java 8, (copied from C#) since it simply feels so unnatural to the language.


The one to rule them all. The browsers that is.


SharpKnight is an Android chess game.


MagicGroup is an eclipse plugin.