Groovy vs. Scala – We Need a Closure…

Disclosure: politically incorrect rant ahead from someone with Grid/Cloud computing perspective…

There was a recent outburst in blogs on the topic of Groovy and how it compares to Java. Although I respect the youthfull entusiasim of Groovy and Co. working on this little exercise I’m just perplexed by the “WHY?” in this whole discussion. Let me just say again: W H Y ?!?!

1. Practically no one cares about Groovy (let alone Groovy++ strap-on) beyond Grails community. So this language just as “widely accepted” as Ruby (at least for enterprise software development)

2. If you know Java it’s equally “challenging” to pick up either Groovy or Scala. Don’t let anyone insult your intelligence by claiming that Scala syntax is somehow more complex than Groovy. In both languages you will need to adapt to functional thinking – and that’s where you will have to spend a couple of weekends…

3. If you know Groovy – you already know 90% of Scala (different syntax and few extra features can be picked up in the evening)

4. Scala is designed by people who have proper academic background, experience and talent in the area of language design – Groovy has never been that way (and anyone who dares to look inside of Groovy runtime or history of changes in it will attest to that). NOTE: it did come out rather strong – but that’s how I feel about it and after some thinking I’ll leave as is. Nothing personal to anyone reading it…

5. Scala as a post-functional language is years ahead of Groovy (static typing with best-in-business type inference, highly tuned mix of imperative and functional styles, powerful and done-right generics, etc.)

6. Groovy will ALWAYS be slower than Scala or Java (latest benchmarks put even Groovy++ about 50 times slower than Java) just by its nature unless someone changes the language and rebuilds the runtime from the ground up.

7. Once we get decent integration with Eclipse, NetBeans and IDEA for Scala, the Groovy will lose its only serious advantage

8. Scala is developed and maintained in Academia (i.e. endless supply of post-docs and plenty of free time to research) – the vey rare case when it is not only appropriate but even desired. While two guys in garage working nights out until we literally pass out off exhaustion was perfectly fine for something like GridGain at the beginning – this is not enough for the general-purpose language development. And, no, VC will rarely if ever touch a language development business…

It really baffles me why would someone pick Groovy (or Groovy++) over Scala these days for non-Grails related work. Most of us will either stay with Java 7, use PHP or Python for quick’n’dirty web thingy, switch to .NET/C# or move to… Scala (all of which are sensible options in their own way). Groovy/Groovy++ just doesn’t fit anywhere in this picture in my humble opinion.

Rant’s over – enjoy!

24 responses

  1. I only looked at Clojure so can’t really comment. But I tend to stick with statically typed and more traditional languages than a Lisp dialect which Clojure clearly is.

    But I like that Clojure sticks to its guns and don’t cut any corners: for all Lisp diehards Clojure is an obvious choice…

  2. wow, the hubris and ego is strong with this one! Your argument would come off better if you weren’t so stuck up and arrogant about Scala. I agree that Scala is probably a very well designed language. But to go and insult everyone who uses Groovy because you think Scala is better is not the way to do it.

    Besides language wars are so stupid. Just use what works and what gets the job done. For me, Groovy and Grails were a breath of fresh air compared to the slogging I’ve done in Java for the past decade. I’ll probably look into Scala too, but if you’re representative of the types of people who use it, perhaps I’ll pass and look at Python or, God forbid, Ruby.

    • Don’t judge by me 🙂 and really read up on at least the basics of Scala to comment on it. As far as Groovy – I happen to know a lot of internal nuts & bolts behind Groovy and Grails as a business and as technology and my comments are representative of that.

      Yes, I’m strong advocate of Scala. Be it as it may…

      Thanks for the commenting!

      • I’m not arguing with the merits of your rant, you’re obviously a very smart guy and your knowledge of both languages eclipses mine easily. I’m arguing with the way you went about it. It’s easier to win people to your side by enticing them with a carrot, not insulting them. Even James Strachan agrees that Scala is better than Groovy. But

        Anyways, life’s too short to worry about which language is better. I’m happy with Groovy and Grails for now.

  3. Hey Ben,
    Could be… But I’m really tired of PC, everybody-wins style of most of the blogs on this subject. Sometime things are lot more clear than we tend to make them. And I specifically marked it as a rant so people don’t get too offended or get too righteous 🙂

    It could be, obviously, that I’m biased. In Grid/Cloud computing world – I’ve yet to see a single Groovy/Ruby or anything like that project. Yet – I’m seeing (few) Scala projects…


  4. I agree, except that I would also include Scala in the phrase “It really baffles me why would someone pick Xyz …” :^)

    None of these alternative JVM languages has the backing of a big industry player. They are not a part of the official Java platform, and probably never will be. (Yes, the Spring Framework isn’t “official” either yet it is/was a big success – the difference is that it filled a real or perceived need in the market.)

    I guess some people just won’t admit it, but JavaFX Script is the only true “next big thing” for the Java platform. It got the backing of Oracle (supposedly – we need to wait a few weeks/months yet for confirmation), has a great team of developers working on it, and is truly great and innovative new technology (check out the new “Prism” graphics engine, for example).

    • Stop pitching JavaFX Script as the Next Big Thing. Seriously! Not a Java replacement by a long shot! It is not in the same league as Groovy, Clojure or Scala. JavaFX Script is a dedicated language that targets a specific niche: UIs. The other 3 are general programming languages that can do UI and much more (notice I didn’t say they can do UI _better_ than JavaFX Script, however I would argue that too). A big company backing a language certainly helps but it is not the single key element for a language’s success, otherwise everybody would be coding in VB6 or C#.

      • Actually, JavaFX Script is already a general-purpose programming language. Just compare it with Java 1.4, for example. Of course, in its current form it certainly isn’t the best choice for server-side programming.

        Just for some perspective, the JavaFX 1.0 SDK was released in December of 2008. The first Scala SDK was released in early 2004.

        Even Java itself arguably started out as a niche language (remember the hype about “Java applets”?). Only with Java 2 it truly began to compete with more established languages.

  5. Wow. You are certainly entitled to you opinion – and I don’t usually wade into these language wars because they are tiresome and trite. Some facts to contradict your opinion are warranted, however:
    * You say: “And, no, VC will rarely if ever touch a language development business…”
    – G2One was VC funded then sold to a larger software company who put more money into Groovy/Grails development.
    * You say: “In both languages you will need to adapt to functional thinking”
    – Groovy is not a functional language and doesn’t promote any functional constructs
    * You say: “Scala is developed and maintained in Academia (i.e. endless supply of post-docs and plenty of free time to research)”
    – When I was in graduate school I don’t remember having plenty of free time. I went to a real university, though, so that may be the difference.


    PS the last one is meant to be an attempt at humor disguised.

  6. Guys,
    No offense taken. I stand by every comment I made. As the matter of fact I know as much about G2One technology and business (including VC relationship) as one could possible have being outside of G2One itself. I left the rest to figure out for yourselves…


  7. Language Wars always lead to nowhere, at the end of the day every person that commented on this post is entitled to his/hers opinion, as well as the author of this post.

    Developing is an activity where you want to use the better tools to get the job done, however, not all developers are inclined or ready to use any tool available, developers tend to specialize, there are Ruby die-hards, Java people, etc.

    In my country a lot of people still develops using C# and VB, and sometimes, I wonder Why ? but at the end of the day that’s the tool they got used or trained to use and it is helpful for them to accomplish their assigned projects.

    I don’t see anything wrong in all these new languages like Groovy, Scala, even Ruby, because they are attempts to make our programming chores easier, and some will feel more comfortable using one as opposed to the other, despite its technical differences and “disadvantages”.

  8. Hi Nikita,

    Just to say I’m quite disappointed… Even if I know it’s not to be taken too serious, it seems to have some strong foundations in your way of thinking.
    You’re a great developper (i’ve read enough of gridgain’s code to ensure that, trust me). You’re turned towards academics, and have a clever mind. Right !

    But what about your customers… (actual or future) ? What about fiiting to their needs ? As I understand you, no one will ever see a line of Groovy code in GG !

    I use GG, and I love Groovy… and I’m not ashamed ! I use GG with Groovy… and I don’t want to be ashamed.

    Language choices are not so easy… Deciding which language is “better” is purely subjective and definitely context-bound. Groovy is closer to Java than Scala, because it is not purely oriented towards functional programming. It has a lot of interesting features like AST transformations or MOP that makes it effective.

    I’m not trying to say which one is better. I’m just saying that now, in my context, Groovy is better for me. And if I decide to become a GG customer, I’d like to see this taken into account… and not be asked the question “Why choosing Groovy ?”

    My 2 cents

  9. It always baffles the mind why people do things like this. If scala is so superior to groovy, surely it can’t be much of a problem to get grails to work in scala ?

  10. @Rogério: no, it is not. JavaFX Script has the following problems to overcome (at least) to be considered a general programming language capable of replacing Java:
    – no generics. Groovy and Scala have them.
    – no threading. You must write threading code in Java.
    – interpreter runs in EDT. ALL JavaFX code is run inside the EDT by the current interpreter. This decision alters how you must design your code.
    – reflection not on par with Java’s.
    – and most importantly, it’s core and libraries are specifically designed for UIs in mind (Java 1.0 was not). You can’t write a web framework with JavaFX Script today. You can’t write a grid/cloud offering with JavaFX Script _today_. You can’t run JavaFX Script applications in Android TODAY (Scala can and Groovy so-so). You can’t run applications in GAE _TODAY_ (Java/Scala/Groovy/JRuby/PHP can). Heck, you can’t even interface with Swing at 100% (-> legacy app support. Believe me, I tried).

  11. @Andres: thanks for the helpful answer! I was wondering what it is, specifically, that you miss in JavaFX Script.

    About generics, consider that Java itself didn’t have it before version 5. C++, the language, still doesn’t have any support for threads. My point is that these facts never prevented those languages from being considered “general purpose programming languages”.

    JavaFX code runs in the JVM, not in an interpreter. It’s compiled to bytecode.

    The EDT restriction is true for binding and UI updates, sure, but this is no different than a Swing-based app; the “javafx.async” package provides support for tasks running outside the EDT.

    Maybe you are right about “reflection not on par with Java’s”, but the “javafx.reflect” package sure looks quite rich to me (see

    About the libraries being focused on UI, sure. The idea for JavaFX is to avoid replicating functionality already available in the JDK, unless there is good reason to do so.
    Actually, I bet you could write a web framework in JavaFX Script today, but what would be the point? JavaFX doesn’t need one, just like Flex and Silverlight don’t need one.

    JavaFX code can easily use existing Swing widgets. I guess you meant using JavaFX from a Swing-based Java app, right?. I read reports somewhere that it can be done, but personally I find it a bad idea. JavaFX is best for the UI, the application front-end, so it makes no sense to use JavaFX code from a Swing app – only the reverse makes sense (to me, at least).

    In any case, JavaFX is still quite young and has huge potential – if Oracle wants it, it will inevitably become a major part of the Java platform.

  12. Academically SmallTalk might be better than Java, but look where it is in comparison to no of applications. Similarly a superb programming language i.e. Scala will become the next Lisp if it is not picked up en-mass. I myself wrote code in Java, Ruby, Groovy, C++, and prefer Ruby on Rails. But in real world I use Java and Spring everyday. I checked out Scala, still reading Programming in Scala by Martin Odersky. Find it too academic. You need something that is productive but easy for average guy like me. But that is my opinion.

  13. The role of differences in programming languages for software development is by far overestimatated.

    In fact there is NOTHING which is not already possible with assembler language.
    And the language of the processor is by definition always able for faster solutions than any higher language.

    The most time we lose in software development is due to ever changing standards and frameworks. This is not a question of some weekends to learn these things. But it takes years to use them efficiently.

    The main advantage of groovy is that it is useful to write compact easy to understand code and that it is used with success in a well designed powerful proven webframework grails. The bridge between java and grrovy is very strong. This is a clear advantage. If we always change the direction, then we are not efficient. The task of software development is to produce solutions for applications and not to learn frameworks and languages.

    Groovy and scala are only programming languages. There is also Google GO and there will still come much more languages. And none of them will be able to solve a problem, which could not be solved decades ago.
    The quality of a programming language depends mainly on the individual perspective and on the certain problem which shall be solved.

    • Well said. At the end of the day the programming language is in itself unimportant. The tools, frameworks, and practices are what makes the difference. That is why I leverage java+spring+hibernate+dwr+extjs+ci+tdd to roll out productive, enterprise grade, rock solid applications as if they were pancakes. Not because Java is a great language, but because all the frameworks and tools I already know how to use and make them work around java. Scala (or any other language) might be more fun and pleasurable to program in, but to build apps I need much more than the language. Of course it is great that there are so many people working on new languages and tools, because the day will come when one of them will replace what we have now.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: