Entries Tagged 'Ruby on Rails' ↓

JRuby – Or how I manage to write Ruby in a strict corporate environment

One of the beauties of the Ruby community is the benefit of choice.  Original Ruby interpreter?  Check.  Ruby interpreter in Java?  Check.  Ruby interpreter in Ruby?  Check.  Ruby for .NET?  Check.  Projects like these make it easier to integrate Ruby in almost any environment.  

Specifically, the development of JRuby has been full steam ahead ever since Sun decided to hire two developers on full-time to work on the JRuby project.  This has meant constant releases, each with a large change set.  The project has most recently hit its 1.1 state which includes a 100% compatible Ruby 1.8.6 interpreter written completely in Java.  This means you can simply drop the JRuby JAR file in your Java project and begin writing Ruby code.  Or you can go ahead and integrate Swing into your Ruby application; seamlessly.

I work for a Fortune 100 company, a defense contractor with a pretty strict development environment.  What does this mean?  For the most part I’m limited to Windows, anything I would like installed on my PC needs to go through an approval process (which can take 3-6 months, easily) and the existing choice of tools is quite limited.  Luckily, Java is one of the big hitters for development in the software department.  The standard load on my PC contains a pretty recent JRE/JDK which opens the door to JRuby.  JRuby at this point is simply a drop in, a tool I can integrate to my existing environment.  It’s not an executable that needs to be virus scanned or something that shows up in the wonderful Windows “Add/Remove Programs” dialog.  

And it is wonderful.

Next, enter NetBeans, an IDE for the big hitter languages; C++, Java and most recently, Ruby and Javascript.  NetBeans is one of the few tools that makes working in Windows a pleasure.  I’m a Mac guy, so spending 9 hours at work on a PC can be painful at times but a properly configured NetBeans can give me an IDE that looks similar to TextMate.  Couple this with Cygwin and I’ve got a pretty similar development environment as I would in a Mac or Linux environment.  Built in Autotest, incredible code completion (including completion on your ActiveRecord models) and integration with the major SCM tools out there makes NetBeans a necessary tool when working with Ruby in Windows.

JRuby has full support for Rails.  Now I have the option to either work in Rails or the company blessed solution of ColdFusion.  Tough choice, eh?  With JDBC drivers for every major database out there, I can quickly prototype and develop applications against both Oracle and PostgreSQL which I have at my disposal.  

JRuby also has a great community with an active mailing list.  Hit a bug?  Missing a feature?  Go ahead and submit a ticket to their JIRA bug tracking instance and chances are it will get addressed in the next release.  I ran into a bug with the JDBC-PostgreSQL driver, browsed their bug tracking library and found that not only had it been submitted already, but Ola Bini, one of their active developers had corrected the bug that morning and posted a fix that I was able to grab and continue on with my development.

But what about getting Ruby accepted by others in your environment?  I think the general consensus on this has been to simply go ahead an whip up an application and go ahead and demo it.  Show off the benefits, the clean code and the time saved by using Ruby over whatever you would have otherwise built the tool with.  Ask for forgiveness later.  

So the next time you have that itch to integrate Ruby (or Rails) at work, go ahead and give JRuby a look.  You’ll be a much happier person because of it and your co-workers who are unfamiliar with Ruby will thank you.