Sneaking Ruby into a Java Shop

Like a lot of Rubyists, I’m working for a company that more or less uses Java exclusively for its software development. And like a lot of those Rubyists, I’d like to find opportunities to start using Ruby in addition to Java (if not in place of it) for some of those software projects.

Since we have a lot of legacy Java code that we can’t just rewrite from scratch in Ruby, I need to find a solution that lets me develop new code in Ruby while taking advantage of that Java legacy code. The obvious choice is JRuby, a Java implementation of the Ruby interpreter. Some other less-promising-looking options include RJava and RubyJavaBridge.

I was a little concerned after my first glance at the JRuby home page because it appeared that there wasn’t much going on; there doesn’t seem to be much there in terms of documentation, and the last news dated from March 2004. Nevertheless, recent posts to the JRuby users’ mailing list indicate that the project is alive and well. I also found a nice introductory article at IBM’s developerWorks site.

Another option which technically isn’t Ruby, but is awfully darned close, is Groovy. I think I first heard about Groovy when Chad blogged about it earlier this year, but since then there’s been a lot of buzz about it in the Ruby community (and elsewhere, I suppose).

One of my concerns about Groovy is the same thing that Chad noted: that Groovy’s designers have put perhaps a little too much effort into making Groovy similar (syntactically) to Java. One of the enjoyable things about Ruby is that (as I believe Dave Thomas put it) it “stays out of your way”; it makes a point of avoiding the awkward constructs found in languages like Java. Another concern about Groovy is the lack of books (so far) about the language. This will no doubt change over the next year or so, as Groovy seems to be on track to becoming an officially blessed scripting language for Java. But in the short term, it means that my co-workers and I are forced to pull together knowledge about Groovy from various sources on the web. A big advantage of Groovy is, of course, that it can be compiled directly into Java bytecode. I’m not yet sure if that’s an option with JRuby.

Posted November 15th, 2004 in Ruby.

Comments are closed.