|
Not Feeling So Groovy
|
Posted: Aug 31, 2006 4:06 PM
|
|
> Dude! You can have your cake and eat it too. > > Groovy is the perfect compromise answer: > > ... > > Sun and Java community should give up trying to shoe horn > difficult new features into Java and instead concentrate > on making Groovy the flag ship companion language. > Ultimately Groovy could become "Java2". > I was very excited about Groovy's potential when I first heard of it, which was quite early on. I wanted to join the project, but realized I just didn't have time to do anything useful. But I was a bit disappointed in one of the features you mention: it will take Java code (up to 1.4, as you mentioned). I find Java code a bit verbose and would really have preferred something not so Java-looking.
I like the idea that Groovy uses Java libraries natively, because with JRuby or Jython, you really have two sets of libraries to deal with: the Ruby/Python one and the Java one.
While I think Groovy is important and useful, I don't think it is a substitute for Java, because its dynamic typing will have a runtime performance effect. It is a different kind of tool, suited for different kinds of tasks. Large swaths of any program are irrevelant to performance, of course, and if you can predict what those are, then Groovy might be a good fit. Unit tests could be written with Groovy for example, and maybe it would be fast enough. (But on the other hand, unit tests are something you want to run very fast.)
But where I use Groovy, I lose the ability to get basic refactoring support (such as rename method) with as much accuracy, simply because there is less information in the code for the refactoring tool to work with. I find it hard to believe the productivity boost I get using Groovy the language would be worth the loss of some of those tools. That's something I liked about Scala: it had a lot of the functional features, code conciseness, and such of languages like Ruby and Python, but was still statically typed. And like Groovy, it very smoothly integrates with Java APIs.
My point is that I think Scala, because it is statically typed, is more suitable as a Java substitute than Groovy. I see Groovy more as an augmentation to Java, a way to do areas of the code that are a good fit for being "scripted."
|
|