I love languages. No, I’m not enamored with French or Spanish. German is kinda cool, but Groovy is, well, really Groovy. It’s no secret I’m a Java fan, I’ve also written at least my fair share of PHP, Python and probably a dozen other languages (C, C++, C#, [Object]Pascal, LISP, JavaScript, BASIC of various flavors.. just to new a few). I’ve played with Ruby (and read some of this amazingly great Ruby book) but I tend to come back to Java (with some PHP now and then for my personal web site). Scripting languages are neat, but I tend to prefer strongly typed languages and like to work in a good IDE (currently I use Jetbrains IntelliJ IDEA for Java code). The only language I tend to despise is Perl – bleh (although I couldn’t get into Forth the couple times I tried).
I’ve been watching Groovy since (approximately) its inception. Groovy is a very Ruby-esque language but with roots in Java. I’ve been meaning to do something with it but have just never gotten around to it. I had heard tell of it’s beautiful abilities to parse XML. I knew it had some degree of interoperability with Java (Groovy scripts execute within the JVM) but I didn’t realize how totally complete the interoperability could be. You can write and run Groovy so that it is plain Groovy, you can write Groovy so that it leverages the Java standard library (or any objects created in Java) or you can compile .groovy files into .class files and treat them like normal Java classes – seamlessly create Groovy objects in Java and vice versa, pass the objects back and forth. Really neat. Do whatever lifting in whatever language you like, completely flexible. The Groovy compiler (groovyc)Â will happily pass compilation of non-Groovy (.java) files to the standard javac compiler so you only need to have one line in your ant script to compile both languages.
After writing the XML parser for my current project in Groovy (the rest of the project is Java) I wrote a couple of other stand-alone Groovy scripts to become more familiar with Groovy and I will say I am very impressed. If you’re a Java programmer (or just a language lover) you should check out Groovy. And for a nice bonus, IntelliJ IDEA comes with a nice plug-in for editing .groovy files.