Links

pmuellr is Patrick Mueller

other pmuellr thangs: home page, twitter, flickr, github

Thursday, October 18, 2007

the vice of debugging

In Giles Bowkett's "Debugger Support Considered Harmful", Giles makes the claim that "Ruby programmers shouldn't be using a debugger".

First, as a meta-comment to this, I truly love to see folks expressing such polarizing and radical opinions. Great conversation starters, gets you thinking in someone else's viewpoint, devil's advocate, etc. At the very least, it's a change of pace from the REST vs everything else debate. :-)

Back to the issue at hand, debugging Ruby. I certainly understand where Giles is coming from, as I've questioned a few Rubyists about debugging, only to have them claim "I don't need a debugger" and "the command-line debugger is good enough". There is clearly a notion in the Ruby community, unlike one I've seen almost anywhere else, that debuggers aren't important.

I twittered this morning, in reference to Giles' post, the following: "Seems like Stockholm syndrome to me". As in, if you don't have a decent debugger to use in the first place, it seems natural to be able to rationalize reasons why you don't need one. I have the exact same feelings for folks who spend almost all of their time programming Java making claims "the only way to do real programming is in an IDE"; because it's pretty clear to me, at this point, the only way to do Java programming is with an IDE. I've personally not needed an IDE to do programming in any other language, except of course Smalltalk, where it was unavoidable. Of course, extremely programmable text editors like emacs, TextMate, and even olde XEDIT kinda blur the line between a text editor and an IDE.

My personal opinion: I love debuggers. If I'm stuck with a line-mode debugger, then fine, I'll make do, or write a source-level debugger myself (aside: you just haven't lived life if you haven't written a debugger). But I'll usually make use of a source-level debugger, if it's easy enough to use. Sometimes they aren't.

Honestly, I love all manner of program-understanding tools. Doc-generators, profilers, tracers, test frameworks, code-generators, etc. They're tools for your programming kit-bag. I use 'em if I need 'em and I happen to have 'em. They're all 'crutches', because in a pinch, there's always printf() & friends. But why hop on one leg if I can actually make better headway, with a crutch, to the finish line of working code? Seems like a puritanical view to me to say "you shouldn't use crutches", and especially ironic for Ruby itself, which is a language full of crutches!

Perhaps there is something about Ruby itself, which makes debugging bad. Or as Giles seems to be indicating, that testing frameworks can completely take the place of debugging. Some unique aspect of Ruby that sets it apart from other languages where debuggers are deemed acceptable and desirable. As a Ruby n00b, I'm not yet persuaded.

As for Ruby debuggers themselves, NetBeans 6.0 (beta) has a fairly nice source-level debugger that pretty much works out-of-the-box. Eclipse fanatics can get Aptana or the dltk (Dynamic Languages Toolkit). I think it would be nice to have a stand-alone source-level Ruby debugger, outside the IDE, because honestly I think TextMate is a good enough IDE for Ruby anyway.

BTW, Rubyists, I'm getting tired of the Sapir-Whorf references.