In a recent thread on the East Bay Ruby Meetup list, several people chimed in with Ruby IDE suggestions. I suggested RubyMine, which we use at Pivotal. Several people mentioned NetBeans and Aptana RadRails, so I decided to have a little contest.
Now, if I am going to work in an IDE and sacrifice the speed of a text editor, I want to see it work for me ('cuz RubyMine can chew through all your CPU and RAM and then some faster than you can say Moore's Law). That means understanding Ruby, and using that information to save me some significant thinking and work.
I don't mean code-generation macros or dumb context-aware keyword-completion, I mean something useful like knowing where my classes and methods are. In my book, that leaves out Emacs, Vi, and even TextMate, regardless of their other merits (sorry people, I like text editors too, but I'm making up this test - flame away, the comments section is below).
So, here's the smackdown scenario:
- Download the latest NetBeans, RadRails and RubyMine.
- Open a Ruby project, this example is one of mine (I wrote this three years ago to learn Ruby, so don't make fun of me for doing dumb stuff...)
- Test the ability of the IDE to navigate through Ruby language constructs. This should be easy, it is a command-line app using a Dependency Injection architecture, no metaprogramming curveballs!
- Open the root Ruby class for the project (
lib/geminstaller.rb) - Pick a variable (
appinself.install) - Try to work back to the class declaration (
GemInstaller::Application) using IDE navigation (Command-clickin all the IDEs, although sometimes they ignore you)
- Open the root Ruby class for the project (
Result? RubyMine succeeded, NetBeans and RadRails failed miserably. Here's what happened in each:
NetBeans
- Click
create_applicationclass method reference inapp = create_application. NetBeans takes me to the method declaration in same class. - Click the
appmethod inregistry.app.
FAIL! ANGRY BEEP! app is an attr_accessor on another class, NetBeans can't find it.
RadRails
- Click
create_applicationclass method reference inapp = create_application. RadRails takes me to the method declaration in same class. - Click
appmethod inregistry.app. RadRails takes me to theattr_accessoron theRegistryclass (without a prompt, and highlighting the symbol, which is even better than RubyMine). - Click (and F3) on the
:appsymbol argument toattr_accessor.
FAIL! ANGRY BEEP! RadRails can't figure out the symbol parameter to attr_accessor. It says "Current text selection does not resolve to a Ruby element".
RubyMine
- Click
create_applicationclass method reference inapp = create_application. RubyMine takes me to the method declaration in same class. - Click
appmethod inregistry.app. RubyMine pops up a dialog asking if I mean theattr_accessoron theRegistryclass, or the local variable I'm declaring. That's rather silly, I admit, but the point is it followed the reference to another class. - Click on the
attr_accessorchoice. RubyMine takes me to theattr_accessorline in Registry. - Click on the
:appsymbol argument toattr_accessor. RubyMine takes me to the point where the@appinstance variable is initialized. - Click on the
Applicationclass name in theGemInstaller::Application.newconstructor invocation. RubyMine pops up a dialog asking if I mean theApplicationclass in my application, or two other Application classes that happen to be in my Ruby installation. This is also a silly question - it should have known the correct choice because of my namespacing, but it still found the class. - Click on the
GemInstaller:Applicationchoice. RubyMine takes me to the class declaration.
SUCCESS! RubyMine drilled all the way to the class declaration, even through an attr_accessor, albeit with a couple of stupid questions.
Summary
I personally think this is a Big Deal. In the past, I've mocked Ruby IDE functionality as a poor simulacrum of the vast power in Java IDEs. When using Eclipse in Java, I could perform epic refactorings, extracting superclasses and adding parameters to method signatures; refactoring scores of classes across multiple projects in a few mighty keystrokes. Yes, I'm fully aware that this is because Ruby is a dynamic language, but that doesn't make me miss a real refactoring IDE any less, and others have long lamented these shortcomings, as well.
So, for years, even though I'd always indulge my pairs if they wanted to use an IDE, I've done all my personal hacking with a fast, lightweight text editor and command line tools. To me, the benefits of a memory- and processor-sucking IDE with tons of unnecessary, unconfigurable, resource-eating tiny-ass-fonts and chrome did not justify giving up the speed and responsiveness of a great text editor.
However, RubyMine can now navigate code for me. I don't have to think and manually find that class, RubyMine knows where it is. Granted, that ain't no Extract Superclass, but it saves me a lot of thought and time, both of which are increasingly rare commodities for me.
To be fair, this is really just a problem related to parsing and interpreting attr_accessor declarations, and I expect that NetBeans and RadRails will pass this test as well in another release or two. That's all great news, because it means that Ruby IDEs are finally, slowly, coming of age. I think I'll still be waiting a long time for an automated Modify Method Signature refactoring, though...

Thanks. That was helpful.
Interesting. I'd been coding Seaside for the past two months, and coming back to Ruby/Rails I feel like the tool support is just so primitive. The IDEs have a LOOOOONG way to go before catching up to Smalltalk environments, but I agree that even basic code navigation is very valuable.
Thanks for the post. I learned something.
I too am a fan of sticking to a good editor. I've been a Vim fanatic for a decade, and yes, I know that's unpopular in the Rails world. I found that using NetBeans with the jVi plugin, I get a lot of the benefits of both worlds. I can slice and dice text crazy fast, but I also get some of those cushy IDE benefits.
I also like NetBeans because I code in a range of environments. NetBeans works pretty well for HTML, CSS, JavaScript, PHP, Python, and Rails, which are my main languages. I still fall back to Emacs for Erlang, Oz, and Haskell, and I use Vim for everything else--Vim is always open for me ;)
The biggest reason I don't use anything based on Eclipse is because it leaves me feel very overwhelmed. NetBeans doesn't scare me so much, and yet I can still use it with most of the languages I care about.
I blogged about my NetBeans experiences:
http://jjinux.blogspot.com/2009/01/ide-netbeans.html
http://jjinux.blogspot.com/2009/07/ide-netbeans-after-six-months.html
@zydeholic - thanks!
@Shannon - RubyMine does have good HTML, CSS, and Javascript support. I never used NetBeans heavily, but I have to say that Idea/RubyMine does just feel a lot nicer than Eclipse.
@Pat - Yeah, I agree, it is still a pretty lame state of affairs - but I didn't say that above because it wouldn't have been as cool of an article ;) Just today RubyMine was unable to figure out where a method was because of metaprogramming or who knows what, and presented me with a list of about a billion occurrences to choose from. I think my scenario above was a real easy chestnut because it was plain-vanilla OO with the tricky part being the attr_accessor.
Thanks for giving us this test, but I thinks it could be better. I use Netbeans every day at work. I can navigate through code, and Netbeans understand where my variables and declarations are. Maybe it´s true and RubyMine has one or two better things, but it sacrifies all my cpu, all my ram, and the worst... it´s not free.
Now, do you really think I´ll pay for RubyMine IDE when I have Netbeans?
I used several trials of RubyMine, and it waist a lot of time skaning projects when I open it. It also breaks 5 or 6 times in two mounths.
I´ll keep Netbeans. But it´s my opinión, and again thanks for yours
@kikorb - Thanks for the comment. Yes, RubyMine isn't free ($99 US), and they have had a few annoying bugs in the latest releases. I also believe you when you say that NetBeans may be less of a resource hog - in my testing, RubyMine and RadRails did freeze several times, but I don't remember NetBeans freezing.
Regardless, in my case, I don't want to learn more than one IDE, and RubyMine is what we use it at Pivotal - and not just for Ruby (it is great for Javascript). So, it makes sense for me to use it (and pay for it) on my personal box - even though I'll still probably use a text editor for most stuff, especially when I want to open up a project and get to work quickly without a lot of freezing.
You mean spare. You said rare, rare commodities. You mean spare.
I personally think this is a big deal.
And what does each one cost?
Good comment. IDEs are the way to go.
The vim vs. emacs fanatics fail to realize that the will never fully make the switch to ingelligent IDEs.
Now, for ruby an IDE is not really needed, but a good IDE would for sure be helpful.
Since you asked for flames from text editor users...
If you need so much refactoring that you need a tool to do it, your designs suck. In Java it makes sense coz it's an awful language. But in Ruby there's no excuse. Now you're going to avoid metaprogramming curveballs since you don't think your IDE can handle it. You're shackling yourself to what your tools can do. The reason us "emacs and vim fanatics" prefer text editors is because we don't rely on tool support for our languages if the language features are powerful enough.
Have a read through Art of the MetaObject Protocol and take another look into some of Ruby's metaprogramming and you'll see a new world open up which your IDE may not support. Avoiding it means you may as well use Java and be done with it. Then you get the performance, the IDEs, and all the frameworks you need.
Since they all support ctags/etags, Dissing Emacs/VIM/TextMate for not knowing where your classes and methods are is a strawman and a silly reason not to use them.
That said, intelligent refactoring support and Eclipse-for-Java-style "quick fixes" is something that would make an IDE genuinely useful. I'm still waiting for a decent library of refactorings in a Ruby IDE. I'll keep trying them periodically to see how they are coming along.
I am using Netbeans for Rails and JRuby development. I use Eclipse for Java development.
I never have really understood why people get wound up over IDE vs Non IDE. I think for some it is a badge of honor to say they don't use an IDE. I guess they think it makes them a better programmer? It is a tool. Just like any other trade, everyone uses different tools and hopefully uses the ones that makes them most productive.
The main reason I like IDEs is because of the debugging features. For debugging nothing compares. I also like having the subversion tools built in as well.
I also don't understand language fan boys. To say Java sucks is just nonsense. Is it the be all end all? No, but no language is. Otherwise if one language was, then all of the others would not be around.
In my testing RubyMine was horrible! It has horrible fonts (common what's the problem the Java guys have with antialiasing) and crashes on our ERP project (more then 100 models)..
I think I'll just stick with gedit (with gmate) and Textmate when I'm on my Mac
An IDE isn't always more productive then a good editor. Everyone who ever used Textmate knows that
Coming from Common Lisp & Smalltalk, i just have to laugh when i read articles like this one. Here is a clue: Ruby is very similar albeit less powerful to other dynamic languages that have existed for decades and have solved what you consider to be issues. It might be wise for you to take a look at these other languages and see what they did and how they did it.
@Avdi: ctags does go a long way towards code navigability in Vim. I still miss Resharper for C#, but my editing is a lot faster with Vim.
@Pat: I was really surprised by what Smalltalk had going long before the Ruby world. The first refactoring browser was for ST. TDD is very easy, since you write a test, run it, type in the code where the test breaks, then continue on. Turtles all the way down. And more. Dolphin Smalltalk was the most fun I've ever had in front of a computer.
Thanks again for the comments. I'll try to respond to everyone:
@Jesse - no, I meant rare. My time (and time to devote thought) for personal, individual (non-work) hacking is increasingly rare - mainly because it is more fun to hang out with my family. So when I do, I hate to unproductively stare at the Beach Ball of Tranquility while RubyMine parses code or garbage collects. That's why I usually fire up a text editor for personal work, since I'm often bouncing between multiple projects in small spurts (unlike Pivotal work, where I tend to stay in one project which mostly negates the IDE startup time).
@Robert - RubyMine is $99 USD. Other two are free. However, I don't hesitate to pay for a good tool, especially if it saves me time.
@Mark - Pros and cons on both sides, but IDEs have some sweet tools. One of my favorite features of Idea/RubyMine IDE is the little gutter indicators which show lines you have modified in your working copy - and you can click to see an instant diff with the version in source control. That is incredibly useful. If anyone knows how to make a text editor do that, please let me know.
@Someone - you have some insightful comments, and some not :). I never learned Lisp, and willfully avoided and unlearned Emacs after being forced to learn it (although I know my way around Vim for console work). I'm pretty sure that makes me a bad person. The only thing I'll take issue with is your assertion that "If you need so much refactoring that you need a tool to do it, your designs suck". Sorry, refactoring is a good and natural part of Test-Driven Design. Red, Green, Refactor. Make it Green, then Make it Clean.
@Avdi - yeah, it was a total strawman, but that's what makes a fun article :) I did forget to mention ctags/etags, mainly because I've never used them. I'd love for someone to apply my test to them, though - how would they handle navigation through the attr_accessor?
@Brian - Yep, arguments (as opposed to discussions) over whose tool/language is better are pointless. Use whatever makes you happy, productive, and money. However, I do believe that the in-IDE debuggers suck compared to ruby-debug from the command line. There is a lot of power in the combination console/debugger where you can be stepping through then type any expression immediately, as opposed to having to pop up a window before you can evaluate anything. Plus, the ruby command line debugger is not hard to learn at all - just use my cheatsheet.
@Paolo - yeah, I agree, I hate tiny-ass fuzzy fonts that are hard or impossible to make larger. In Textmate I can just hit cmd-plus and crank EVERYTHING up to whatever size my aging eyes need. Dunno about the crashes - we run some big projects in RubyMine at Pivotal. The one I currently have up has 100+ models in the app itself, and probably close to a hundred more mixed in from plugins via Desert. Maybe you should give the latest RubyMine 1.1.1 a spin, they've done a lot of work on it
@John - I don't come from Lisp or Smalltalk, and I'm pretty sure that makes me a bad person. I'm not a language geek (IBM Mainframes and Java are my background), but I do know OO. Ruby is a great OO language, and it makes me Happy, just as Matz intended. It also makes me a decent living with good job security (thanks Rob, Matz, David, and Zed!)
@Mark - As Joe said, I respect Old Dudes who Know Smalltalk (no offense to Old Dudes, I'm well along the path myself).
Komodo is actualy quite a good Ruby IDE too. It's not free, and is't ruby-only, but it's my favourite for Ruby.
Hello Chad,
Nice comparison =). As for RubyMine I've just wanted to highlight one moment in your code: You usually use require calls like this:
<code> dir = File.dirname(__FILE__) require File.expand_path("#{dir}/geminstaller/requires.rb") </code>unfortunately RubyMine doesn't understand such require, but if you use a bit another presentation:
RubyMine will understand it and will be a little smarter =)
@Mark - Pros and cons on both sides, but IDEs have some sweet tools. One of my favorite features of Idea/RubyMine IDE is the little gutter indicators which show lines you have modified in your working copy - and you can click to see an instant diff with the version in source control. That is incredibly useful. If anyone knows how to make a text editor do that, please let me know.
I'd like to point out that Netbeans has this too... plus it also saves snapshots of files you are working on, so you can go back however long you've been working on a file and see what happened before you went down the rabbit hole :D