Link Details

Link 804235 thumbnail
User 478055 avatar

By mitchp
Published: Jun 08 2012 / 10:37

We recently got a post on Javalobby from a new contributor, Pavel Bernshtam. He wrote an explanation of why he thinks Groovy is a "Better Java". I was initially going to see how everyone on JL felt about that statement (maybe a poll to see who thinks Groovy is preferable in a situation where speed of development and not performance is the main goal.), but then I read the comments:
  • 17
  • 2
  • 2153
  • 1460
User 226303 avatar

devdanke replied ago:

-2 votes Vote down Vote up Reply

I believe Groovy/Grails is not production ready and probably never will be.

One reason is that it's a dynamic language. This means, when writing code, your IDE will list scores of methods to choose from for auto-completion, instead of just the few possible ones you'd get with Java. This is a constant irritation when write Groovy code.

Another reason is, Groovy stack dumps are much harder to decipher than Java stack dumps. This has a lot to do with Groovy's closures.

Third, the power available in the Grails tag library and expression language is actually dangerous. It lures you in to putting too much programming logic in the web page, which is hard to debug and unit test.

Fourth, Groovy is, as far as I know, by far the slowest dynamic language. If you don't believe me, write a medium complexity script in Groovy, Ruby, and Python, then time it. The results are eye opening.

Fifth, Groovy itself has a lot of magic in it. Grails is built on top of things like Spring and Hibernate. These have there own magic too. This makes initial development a little faster, as long as you do things their way. But when things go wrong in production, and you need to understand what's really going on with your app, you're forced (possibly under deadline pressure) to understand the magic in all these layers. It's too much for the mortal mind.

Groovy/Grails is not a silver bullet. Even Ruby on Rails, the model for Grails, continues to decrease in popularity since its hay day a few years ago. Neither of these frameworks are enough better than Java to justify not using Java. Also, if your company creates production Groovy apps, it'll be tougher to find qualified developers to hire. A lot of Ruby on Rails shops are discovering this sad reality now.

In conclusion, you're better off using Java and Java frameworks, for production web apps. Developing with these frameworks directly, you'll understand them better. This will make it easier to maintain your code, especially when hunting down bugs.

User 900413 avatar

smaldini replied ago:

3 votes Vote down Vote up Reply

I stopped reading at "One reason is that it's a dynamic language". Then I took my courage and I finished reading your comment.
Do you know NodeJS ? MeteorJS ? All the JS MVC frameworks around ? Do you have numbers for the angry Rails shops ? Gradle ? Do you see the Groovy 2.0 features ? Do you know that Grails 2.0 doesn't enforce Hibernate use ? Do you know IntelliJ IDEA , Eclipse STS, Netbeans ? InvokeDynamic ? Do you rely on your IDE to refactor ? Have you heard about test coverage ? BDD ? Continuous Integration ? Did you start this comment 15 years ago and copied it now under this groovy article ?

Groovy and Grails never wanted to replace Java or standard Spring MVC, they bring productivity where you need it, usually in top level features. Well for some people, Grails apps are just using full Groovy, and Groovy 2 is a full replacement for Java.
I've seen critical applications (high profiles, major webapps, health sector, even nuclear company) and startup applications just succeeding well and keeping using it because the devs know what they do and certainly what they win. And they win time to market, they win fun to work, they win readability, maintainability, time to get more tests, they now focus on features. Its not a baseline for a shampoo advertising, its true, you focus on your needs. These people are not idiots, they know the cost of such abstraction level. Time by time they just go deeper in the underlying framework to setup a niche stuff. That's the way they win time.

Typing is overrated value, just as premature optimisation. Relying on typing can be just dangerous as using Metaprogramming, did you really get repeated ClassCastExceptions ? If you have troubles reading your code, typing wont help you...

Smart people don't care about that kind of stupid comment, because they use the tool they want and perform better than usual. That's all what matters to dev, to ops, to devops, to finance, to customers.

User 989095 avatar

joesoap2000 replied ago:

0 votes Vote down Vote up Reply

It's becoming increasingly clear that Groovy (and Scala) are becoming increasingly popular Java language alternatives while remaining on the JVM and using the tools and libraries we know.

Add your comment

Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Apache Hadoop
Written by: Piotr Krewski
Featured Refcardz: Top Refcardz:
  1. Play
  2. Akka
  3. Design Patterns
  4. OO JS
  5. Cont. Delivery
  1. Play
  2. Java Performance
  3. Akka
  4. REST
  5. Java