Friday, September 28, 2007

Ruby: Trivial Debugger Implementation

A common question you receive as a Ruby developer is: Don't you miss robust debugging support? The short answer is No, but that's not entirely true. The reality is that Ruby developers are generally willing to make trade-offs in order to work with a language that they find more pleasing.

Do I wish I had a great IDE with fantastic debugging support? Of course I do, and I'd also like refactoring support while we are daydreaming. Until that day comes, I'll continue to look for other ways to be effective.

To mitigate the debugging issue the Ruby developers I work with end up relying very heavily on their tests; therefore, debugging becomes less of an issue. Unfortunately, even the best testers can't always isolate complicated issues. In these circumstances the best Ruby developers are often forced to use the age old debugging strategy of printing values. I was recently in one of these situations and I used the following statement in lieu of the typical p statement.

loop do
p eval(gets)
end

I do miss mature tools and infrastructure. However, the ease in which I can create adequate solutions in Ruby makes it hard to consider doing anything else, currently.

5 comments:

  1. What about a more powerful debugging method?

    With puts you cannot get debugging on rails, as exmaple..

    Ruby-debug is your friend :-)

    RubyForge ruby-debug project page

    ReplyDelete
  2. http://activestate.com/Products/komodo_ide/fix.plex

    solid debugging for ruby - including rais support.

    ReplyDelete
  3. Anonymous7:17 AM

    Try the netbeans version 6.0 beta.
    It has great debugging and some refactoring support.

    ReplyDelete
  4. Just a quick +1 for ruby-debug. I had never stepped through ruby code before, and found myself venturing down the rabbit hole that is a full rails request just by using 'debugger' in a controller and continually hitting 'n' + return.

    Good times and something I think more rails developers should play around with.

    ReplyDelete
  5. I'm not sure I understand: RDT for Eclipse (now part of Aptana) and DLTK Ruby (for Eclipse, base of CodeGears' 3rd Rail IDE) support debugging - RDT has done so for many years (as a matter of fact, the Netbeans debugging support is based on the code from RDT) and also does ruby-debug debugging.

    ReplyDelete

Note: Only a member of this blog may post a comment.