Close
Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

LABS
The Great Ruby IDE Smackdown of '09

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 (app in self.install)
    • Try to work back to the class declaration (GemInstaller::Application) using IDE navigation (Command-click in all the IDEs, although sometimes they ignore you)

Result? RubyMine succeeded, NetBeans and RadRails failed miserably. Here’s what happened in each:

NetBeans

  1. Click create_application class method reference in app = create_application. NetBeans takes me to the method declaration in same class.
  2. Click the app method in registry.app.

FAIL! ANGRY BEEP! app is an attr_accessor on another class, NetBeans can’t find it.

RadRails

  1. Click create_application class method reference in app = create_application. RadRails takes me to the method declaration in same class.
  2. Click app method in registry.app. RadRails takes me to the attr_accessor on the Registry class (without a prompt, and highlighting the symbol, which is even better than RubyMine).
  3. Click (and F3) on the :app symbol argument to attr_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

  1. Click create_application class method reference in app = create_application. RubyMine takes me to the method declaration in same class.
  2. Click app method in registry.app. RubyMine pops up a dialog asking if I mean the attr_accessor on the Registry class, or the local variable I’m declaring. That’s rather silly, I admit, but the point is it followed the reference to another class.
  3. Click on the attr_accessor choice. RubyMine takes me to the attr_accessor line in Registry.
  4. Click on the :app symbol argument to attr_accessor. RubyMine takes me to the point where the @app instance variable is initialized.
  5. Click on the Application class name in the GemInstaller::Application.new constructor invocation. RubyMine pops up a dialog asking if I mean the Application class 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.
  6. Click on the GemInstaller:Application choice. 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…

Comments
  1. zydeholic says:

    Thanks. That was helpful.

  2. Pat Maddox says:

    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.

  3. 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

  4. Chad Woolley says:

    @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.

  5. kikorb says:

    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

  6. Chad Woolley says:

    @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.

  7. Jesse says:

    You mean spare. You said rare, rare commodities. You mean spare.

    I personally think this is a big deal.

  8. Robert says:

    And what does each one cost?

  9. mark says:

    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.

  10. someone says:

    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.

  11. Avdi says:

    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.

  12. Brian says:

    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.

  13. Paulo Cesar says:

    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

  14. John says:

    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.

  15. Mark Wilden says:

    @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.

  16. reinout says:

    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.

  17. 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:

    
    dir = File.dirname(__FILE__)
    require File.expand_path("#{dir}/geminstaller/requires.rb")
    

    unfortunately RubyMine doesn’t understand such require, but if you use a bit another presentation:

    
    require File.expand_path(File.dirname(__FILE__), "geminstaller/requires.rb")
    

    RubyMine will understand it and will be a little smarter =)

  18. @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

Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *