RE: To Groovy or to JRuby

Shay Banon ask the question : To Groovy or to JRuby?
It seems that these days, whenever we see Groovy mentioned in blog post, it must be compared to Ruby or more specifically to JRuby. Then, in the comments, we have some Groovy lover express that Groovy is better than JRuby for the Java developer. What is funny is that people who are working on JRuby suggests that you try both and see for yourself.

Now that Groovy achieved to deliver a 1.0 version (and now a 1.1), it seems that this trend is increasing... Groovy advocate are becoming more vocal about their stuff. Instead of pushing Groovy/Grails for what it's worth, they are pushing it by saying how easy it is to learn compared to Ruby/Rails for a Java developer perspective. This is the argument that's being repeated over and over! And, as we see in some post comments, this makes some manager feel better.

This makes me feel sad!

Now this argument has some truth in it, but this does not necessarily make Groovy a better alternative than JRuby for scripting the Java platform. Learning a new language is always a good thing... Be it Groovy, Ruby, Python, etc. You never really loose by learning a new language... You never really loose by learning a new API, a new framework. Learning new things makes you a better programmer.

This is why I prefer Ruby/Rails than Groovy/Grails... It's not because Ruby/Rails is superior, it's just that learning a completely new language/framework help me open my mind to new ways of thinking. Learning Groovy will also do that, but to a much smaller extent. This will help me become a better programmer... Even better it will keep my mind awake enough to not become a dinosaur who know only one language/framework.

And to the manager that may read this... Having developers who have an open mind and bring new ideas is way better than having developers that will not stray away from their main comfort zone. It cost less in training and allow you to get advantage of new technologies as they become mainstream instead of missing the boat.

Don't take this post as telling you to choose JRuby, like Charles Nutter said, "don't let anyone make the choice for you."


Scot said...

Don't take this post as telling you to choose JRuby

But it kind of does tell to you to choose JRuby, in much the same way as many of the Groovy lovers posts did. :-)

Thinking about it, stating one language over another is what answers Shay's question: "So, to the question presented in this title, what should a developer learn?". Sitting on the fence (ie, try them both), isn't answering the question :-). On the other hand, learning Groovy is more like learning a new dialect of a language, instead of learning a new language entirely. If a developer is learning a new language to find a new way of looking at things, they'd probably be better off looking at a functional language like Haskell.

In the interests of disclosure, I've tried both (pure) Ruby and Groovy (though not JRuby), and I prefer Groovy. It was just so easy to get started with, and I've even started to use grails (and after having used rails, grails seems a lot more solid, even if it's only just had it's 0.5 release).

Scott said...

Personally, I learned to write Groovy using the Ruby Pickaxe book. You can choose make Groovy look like Java but you can also make it look a lot like Ruby. Which programming idioms you embrace in your Groovy depends on a persons level of desire to think differently.

I would argue that you can write very dynamic code in Groovy if you choose to. What's nice with Groovy is that you can discover this over time without having to learn new tools, database libraries, data types, module packaging, runtimes, etc... IF you already know Java.

There are lots of ways to look at it.

Personally, I think its simple. After coding in either Ruby/JRuby or Groovy, after several months, you will start looking at programming differently. So which one? If you are a C/C++ programmer - JRuby. If you are Java programmer - Groovy. This will get you into dynamic programming quicker.

If, after several months, you start pushing the edges of either language, take a look at the other if you so choose. You'll be a position to make an informed decision with regards to the work you're trying to do.

AdSense Links