Sunday, November 30, 2003

Am I a Bad Programmer?

I reckon I must be. Bob Martin wrote that Debuggers are a wasteful timesink. I have been doing TDD now for about a month, so I'm no expert nor do I claim to be. I've been trying to do TDD in the programming that I do in my spare time, and I still need and want a good debugger. I use a debugger a lot as an exploratory tool. And while looking at a test sure does help (I would rather have a test than not), I still walk through the code with my debugger when I'm in code that I'm new to. I can't tell you how many programming mishaps I have found this way. Sure, the tests ran, but I found things that weren't quite right. To me, a debugger allows you to see the program as it is alive. Simply looking at code is like looking at something dead and reason how it is when it was alive. I'm not an archealogist, so why guess when I can run the program?

I'm not trying to downplay TDD, but I am amazed that anyone would say that debuggers are bad. I see no problem with being too dependent on them at all. I have found that I am generally using my debugger in new code and when my tests fail. I like TDD because I have a short piece of code that I can execute without running all of the program to find a problem. Thus, it makes debugging a lot shorter and easier. I think the two go hand in hand.

No comments: