Learning Ruby with NetBeans

I have been curious about Ruby for a while now but haven't had the time nor opportunity to use it. A week ago however I decided to use it to automate some build tasks.

Getting started with Ruby on Mac OS X is easy enough. The runtime and interactive shell is included. Looking around for a good place to start I found the Ruby in Twenty Minutes tutorial. This was a great start and got me going.

Once past the tutorial I started working on the tasks that my script needed to preform. I was using TexWrangler to edit the code and ran it in Terminal. And of cause using irb to try things out. This is really all that is needed to create Ruby code, which is great.

However, being from the Java world I was curious to find out what the NetBeans Ruby plugin would offer me that this set up does not. Since the scripts are part of a much larger Java project built using Maven there is no overhead to open it in NetBeans. So having already passed this obstacle of launching the editor was a nice supprise. It packs some really good functionality for a Java developer just starting out with Ruby.

The most striking is the hints it gives on how to structure the code in a more Ruby like manner. For example, coming from a Java background I would write an if statement like this:

But NetBeans recommended that I write it like this:

This makes a huge difference in readability. Further more I don't think I would have picked this up was it not for the NetBeans Ruby plug-in. Since I had no intention to dig deep into Ruby, but only create a simple script, I would not have searched around the internet and read loads of Ruby code. Nor would I have had anyone else to review the code and come with feedback. But getting this kind of advice from the editor helps improve the code and increase my awareness of the language. This is a great way to get started quickly.

I would definitely recommend others in my situation to try this out. But if your intention is to really learn the language you are better of reading loads of well written Ruby code. That is by far the best way to learn how to express one self in a new language. But with limited time NetBeans does provide a quick way in.