Just back from the Jazoon 2008, Tutorial day (the day before the actual conference starts). I attended Ted Neward’s talk “The Busy Java Developer’s Guide to Groovy“. As always, the talk was quite a lot of fun even for someone like me, who already knows a lot about Groovy. If you get a chance to attend a talk given by Ted: Go. It’s worth it.
In his talk, Ted crammed a pretty complete introduction in the key features of Groovy into three hours. For me, the key points of the talk were these: Productivity and ceremony.
Research shows that all developers roughly write the same amount of code lines per day. The difference between guru developers and the greenhorns is that the gurus write a line once and it works first try and each line achieves much more in respect to reaching the goal than any line of a novice. So in order to boost productivity of a guru, the only way is to use a programming language which can achieve more in a single line of code (and we’re talking one statement per line here, obviously). So it’s not that the guru writes ten times as much code per day as the novice, the novice just writes every line ten times because every time, (s)he gets something wrong and has to fix it.
The other aspect is ceremony. A lot of code in Java is ceremony. In most cases, the Java compiler knows where a statement ends and it wouldn’t need the semicolon. Still it insists that I press the key anyway (and it’s two keys on the German or Swiss keyboard). The same goes for many other things in Java which are just there for tradition. It would be simple for the Java compiler to infer the type of an object after if (obj instanceof ...). There really is no need for the cast in the next line. I could find another 10 examples easily.
Groovy does away with all that. It comes at a price, though. If you like to rely on the compiler creating a cozy padded cell for you, checking types and syntax as much as possible, then Groovy is not for you. In Groovy, the idea is that the developer knows exactly what (s)he’s doing and all (s)he needs is the fastest path to get there. You can do all the dirty things you wished for in Java but you don’t have to. Groovy is an “also” language, not an “either-or” language. If you feel that Java is dirty enough, already, try Scala.
If you want to know more about Groovy and you’re in Zurich, why not attend my talk on Thursday?