The No.1 i-Technology Magazine in the World !
   
 
Clint Shank's Blog

Groovy or JRuby?

posted 24 Mar 2007
Which dynamic programming language should I introduce to a group of relatively young, inexperienced Java developers? The choice is between Groovy and JRuby.

Ruby and particularly Ruby on Rails has been hot for awhile now. Ruby in the enterprise is becoming more accepted. As Martin Fowler pointed out nearly a year ago in this blog entry , some top minds in our field including Bruce Tate, Justin Gehtland, and Stuart Halloway have moved Beyond Java . Even one of my old mentors, Mike Gaffney , has repeatedly told me to bail on Java. But I agree with Scott Davis as he points out in this podcast , Java is not dead.

The growing acceptance of Ruby is a strong reason to consider JRuby. Being able to run Ruby on Rails apps on the JVM is very appealing. But remember the context of the decision here. We're talking about a group of developers whose only development language has been Java, and whose projects for the foreseeable future will run on the Java platform. Groovy wins in this context.

There are lots of reasons to get excited about Groovy. It too runs on the ever-improving JVM. In fact, it was the first scripting language officially approved by Sun to run on the JVM. It can be compiled to byte code or run in script form. The interoperability is fantastic. Developers can still use Java, its tools and familiar libraries such as Spring and Hibernate , where appropriate, and mix in Groovy, where that is more appropriate.

But what really makes this decision easy is the similarity in language syntax. You can take a snippet of Java code, drop it into a Groovy file, and it will nearly work. Then, you can take that snippet and start making use of Groovy language improvements such as closures to make the code more readable and intention revealing .

So the decision is easy here. Take the seamless step forward and introduce Groovy.

tags:    

links: digg this    del.icio.us    technorati    reddit




1. dysinger left...
24 Mar 2007 5:51 pm

Rails is not "All that!". Ruby is cool and terse and flexible but in not anywhere as mature as Java. Take it from a 10 year Java dev who is working 3 months now on a Rails project. Rails seems to attract a lot of PHP hacks, newbie (to programming in general because thy heard Rails was "easy") and just generally people with Bad habits or low OO skills too (which is something to think about when hiring).

I saw Groovy! It is a cool language and you would be able to leverage almost all of your investments and API knowledge in a more terse and flexible Ruby-like way.


2. Charles Oliver Nutter left...
26 Mar 2007 7:33 am :: http://headius.blogspot.com

One thought to consider: Do you want your students to only ever learn from Java and derivative languages? I believe it may be a better goal to challenge them with a language that's more different from Java itself, and Ruby has opened many people's eyes to a new way of looking at problems. It seems unusual to look for what would be "easiest" for students, when the most rewarding challenges are not found the easy way.

If your only goal is to team Java students how to program in a Java-derivative language, perhaps Groovy is the best choice. But if your intent is to expand their horizons, choosing a language designed around its own goals, rather than around Java compatibility, may serve your students better.


3. Clint Shank left...

Charles,

That's an interesting point, but I'm not in the academic world. I'm talking about taking, what I think is the most appropriate step forward with Java projects in the business world.