[rspec-users] Prepare for newbie-ness
mark at mwilden.com
Wed Sep 17 02:02:27 EDT 2008
On Tue, Sep 16, 2008 at 6:11 PM, Scott Taylor <mailing_lists at railsnewbie.com
> Yeah - I use a debugger all the time
I regard using the debugger as a bit of a smell. It often means my code
isn't clear enough to just bench-step through. In a way, it's like
commenting. Complicated code often needs comments and debugging. Code should
avoid being complicated.
I also have found myself relying on the debugger and print statements too
much, when a better approach is to take a step back and really ask myself
what the problems could be. It's so easy just to insert a breakpoint and
start examining variables, in the hopes that something will jump out at me.
All that said, I don't understand my coworkers who don't know how to use the
debugger (and who don't use my l() function). I've always said that in life,
there's the fast hard way and the slow easy way. Learning to use tools
effectively is the fast hard way. It takes effort, just like sharpening an
axe. But you end up cutting down a lot more trees.
The Smalltalk debugger, of course, is in a class by itself. When the
debugger comes across a missing method - say, because you wrote the test
before you wrote the method - it puts you - live! - in a skeleton of that
method, complete with the actual passed parameters. You fill in the guts and
continue on your way. Far too easy. No wonder it never caught on.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users