Donnerstag, 23. Juli 2009

Alternatives to Java: Why Groovy isn't it

Do not get me wrong: When I wanted to leave Java and glanced at Groovy, I really liked it. The powerful syntax, the dynamics, CLOSURES, everything. Groovy is a brilliant language in many parts, no question about it. However, there are IMHO some dramatic downsides.

It would list them as the following:
- Dynamic classes, methods and attributes
Definitely a nice feature for some people, but for the static man as me how even shuns overloaded methods as a failure of java, dynamic methods and classes are just an akward evil with little to none advantages. Of course I can make dynamic method names, but I think they do not offer you much you really need. There are always clean and short ways around this issue, and its impossible to explain to beginners.
- Shiny Magic
And again I'm on the "Static is Good Road" which blindfolds me for the greatness of dynamic languages and their different ways to influent my current code. But really, a lot of things happening in groovy seem to much magic for me, comparisions etc. And I do not like magic which could result in strange run time exceptions about which my compiler will never have a damn idea.
- Performance
While groovy 's performance is perfectly ok for a scripting language and brilliantly for this use case, its too complex and powerful to create very fast code for large applications on the jvm, i would say. This is of course a thing thats hard to judge in detail, but it could really be a problem. On the other hand, who would manage a large software problem with a dynamic language?
- Dynamic Languages are hard to support via IDE
Not a problem, just a conclusion. If you write dynamic languages, an IDE cannot really support you as most pitfalls are hidden in areas where a compiler cannot find them. So you have to stick with your brains. Of course, this is not a failure of Groovy. NO, far from that. Its just my personal problem (as i like IDEs) and the luxury of stuff like syntax analyzation and code completion.
To be exactly, without code completion, writing Java code would be impossible painful. Groovy on the otherside, is very simple to write right out of the box, but its hard to support it much more. Dynamic typing might be the one problem, but much more important is the fact that method completion is very hard to implement, as there are so many dynamic things.

The final point is also the killer argument. Groovy was never intended for replacing java, as statical and dynamic languages are for completely different use case scenarios. See also the performance backlash from which groovy suffers.
However, as long as the main language is as crappy as Java is, Groovy is the nice and brilliant script language to support it. Its in most parts well designed, and its more java than jruby is. Beanshell does not count, as it's just interpreted java with minimal sugar.

Keine Kommentare:

Kommentar veröffentlichen