a little madness

A man needs a little madness, or else he never dares cut the rope and be free -Nikos Kazantzakis


Re: Groovy Or JRuby

Martin Fowler makes an interesting claim in GroovyOrJRuby:

A strong reason to prefer Ruby is the fact that it lives in multiple implementations.

Fowler is alluding to the fact that Groovy runs on the JVM only, whereas “Ruby can run directly on mainstream operating systems with a C runtime, and is starting to run on .NET’s CLR”. I don’t see this as a strong advantage for Ruby at all, for two main reasons:

  1. If you need portability across mainstream operating systems, you already have it with the JVM (to a similar enough extent as with Ruby).
  2. If you need tight integration with a platform, I don’t think either the JVM or CRuby implementation has a clear advantage.

When you start a project, you need to decide what tradeoff to make between portability and depth of platform integration. If you favour portability, you can just take the JVM then choose whichever language you please. If you favour depth of integration, your platform will often dictate the language. If you want both, implement the portable part on the JVM and go native for the rest.

Liked this post? Share it!

10 Responses to “Re: Groovy Or JRuby”

  1. November 30th, 2007 at 5:04 pm

    Charles Oliver Nutter says:

    An aspect of having multiple implementations that Martin didn’t seem to get into is that having multiple implementations forces a language or platform to “grow up”. Ruby has gone through its share of growing pains, especially in the areas of performance and internationalization (multibyte character support). Performance is significantly better in many cases in JRuby over the 1.8 implementation of Ruby in C, meaning lots of folks are considering JRuby as a deployment option. Ruby 1.9, however, has stripped out a number of features that limit performance and ended up passing JRuby for a number of cases. And while JRuby provides access to Java’s excellent Unicode support, Ruby 1.9 will provide encoding-agnostic changes to String handling to support internationalization across a wide range of characters. And the cycle continues.

    Part of what has made Java such a successful and powerful platform is the fact that there are so many different implementations. Competition drives all parties to do better, and as a result the JVM in its many forms is an amazing piece of software.

    It’s unlikely that there will ever be a competing implementation of Groovy, since it has so many very specific features tied to Java and the Java platform, and having several implementations for the JVM would be unlikely to produce much diversity. It may mean that Groovy remains the only language of its type and will flourish in that niche, or it could mean, if things go unchecked, that Groovy devolves into a mishmash of poorly-integrated features, since there’s no alternative implementation to show “a better way.” I have every confidence the core Groovy team can keep this from happening but it’s a bit like they’re chiseling away at a statue nobody’s ever seen before or setting out on a voyage to who-knows-where. Steering those waters without a map is going to be a lot harder without other implementations’ examples to follow or avoid.

  2. December 1st, 2007 at 1:43 am

    Jason says:

    Hi Charles,

    Thanks for stopping by. Indeed competitive pressure can be a good thing. Certainly I think this is a more concrete point than Fowler’s. Funnily enough it seems competition is waning these days in the JVM space.

    However competition does not just have to be against an implementation of the same language. At the moment the dynamic languages are pushing each other along, after all. Re: Groovy not having an existing implementation to compare to: this is the normal case for any new language after all!

    Personally I don’t have anything invested in Groovy or Ruby – I just thought Fowler’s point was odd. To me the portability of the JVM trumps the ability to run on different Ruby implementations.

  3. December 1st, 2007 at 3:57 am

    Charles Oliver Nutter says:

    Fowler’s point may be valid in one sense: Folks averse to anything “Java” related may be more likely to consider JRuby because there is a non-Java version and because it has a very non-Java syntax. And they can start on either C Ruby or JRuby and move to the other, so there’s some comfort level for both ends. With Groovy you’re pretty much bound to using the JVM in all cases, and there’s no option for running the same code on a native implementation or on .NET for example. With 2 or more native Ruby implementations, 2 JVM Ruby implementations (XRuby is the other), and 2 .NET Ruby implementations (Ruby.NET, IronRuby) there’s a lot more choice. For some reason, that makes risk-averse managers a little less worried.

  4. December 1st, 2007 at 6:09 am

    Guillaume Laforge says:

    Groovy runs fine on .Net through IKVM, and then integrates with the .Net libraries. But it’s not strictly speaking another implementation for another platform. Anyway, I don’t see as a limitation, nor do I think it would prevent from doing a good job implementing Groovy.

  5. December 1st, 2007 at 7:16 am

    Web 2.0 Announcer says:

    Re: Groovy Or JRuby…

    […]Martin Fowler makes an interesting claim in GroovyOrJRuby: A strong reason to prefer Ruby is the fact that it lives in multiple implementations. Fowler is alluding to the fact that Groovy runs on the JVM only, whereas “Ruby can run directly on …

  6. December 1st, 2007 at 9:32 am

    What about says:

    What about Flex & Silverlight? Soon(ex. flash 10 astro) devs will be able to use Ruby to make RIA apps – what about Groovy?

  7. December 1st, 2007 at 11:20 pm

    Steven Devijver says:

    Martin Fowler is a Ruby lover and a Groovy hater. Big deal.

    Last time I checked you can run a JVM just about anywhere. Neither JRuby, Ruby or Groovy run on mobile devices.

    And I’m sure there are platforms that don’t have a Ruby port yet do have a JVM. Down goes for Mr. Fowler’s argument.

  8. December 2nd, 2007 at 2:07 am

    Robert says:

    Programming Languages: You are going to use the one you like. End of story.

  9. December 2nd, 2007 at 12:24 pm

    Charles Oliver Nutter says:

    Steven: http://headius.blogspot.com/2007/11/jruby-on-me-devices.html. And I know there are embedded applications that run stripped-down versions of Ruby. There’s not been particularly high demand for such things, though.

    Guillaume: I knew you’d mention IKVM, but to my knowledge nobody’s running anything real on IKVM and I can’t imagine the performance would be as good as either normal JVM execution of Java code or normal CLR execution of CLI. But I absolutely believe having multiple implementations would be beneficial; wouldn’t performance be more of a focus if there were an alternative implementation called “Gravy” that ran ten times as fast? Competition is a good thing, and Groovy would benefit from having a direct competitor implementation.

  10. December 3rd, 2007 at 3:57 am

    Steve says:


    I think you’re missing the point of Fowler’s argument. Yes you can run a JVM almost any kind of machine. But that’s not quite the same thing as saying you can run a JVM on almost any platform, depending on your definition of platform. It will be great to be able to write .NET apps in Ruby. Not sure how IKVM will pan out. At my company we have a mixture of shell scripts, Java/JVM apps and .NET apps. Right now I can write shell scripts and Java apps in Ruby. I can’t write .NET apps in Ruby; we have to use C# or VB. Being able to use Ruby on all three ‘platforms’ will be beneficial.

    Another thing Fowler didn’t point out is that writing Groovy apps on the .NET platform wouldn’t make much sense for VB or C# programmers. Groovy has a lot of things inherited from Java that ease the transition for Java developers, but they’d look like warts to C# developers. Groovy makes sense for Java developers writing for the Java platform, but not elsewhere. That’s why I think Groovy will remain a niche or transitional language.

    Another Steve

Leave a Reply