This post originated from an RSS feed registered with Agile Buzz
by James Robertson.
Original Post: Debuggers - bad?
Feed Title: Cincom Smalltalk Blog - Smalltalk with Rants
Feed URL: http://www.cincomsmalltalk.com/rssBlog/rssBlogView.xml
Feed Description: James Robertson comments on Cincom Smalltalk, the Smalltalk development community, and IT trends and issues in general.
Robert Martin has an article up on the dangers of debugging:
I teach a lot of classes in C++, Java, C#, TDD, XP, Patterns, etc. In those classes I often have the students write code. It is not unusual for me to find a student with his or her nose buried in a debugger, painstakingly stepping from line to line, examining variables, setting breakpoints, and generally wasting time. The bug they are tracking could be found through simple inspection of the code.
I consider debuggers to be a drug -- an addiction. Programmers can get into the horrible habbit of depending on the debugger instead of on their brain. IMHO a debugger is a tool of last resort. Once you have exhausted every other avenue of diagnosis, and have given very careful thought to just rewriting the offending code, *then* you may need a debugger.
Everyone (here>http://radio.weblogs.com/0102279/2003/11/30.html#a1564], here, here, and here, for instance) has chimed in with agreement and an "atta boy". I guess that leaves me to disagree
The basic premise - that you shouldn't live in the debugger - is true enough. You don't want to send your time hacking code until it works, which is what living in the debugger will do. On the other hand, Smalltalkers, for instance, have a debugger that is a code browser. The last sentence in Martin's statement - that you should exhaust all other avenues before debugging - is just silly. By that line of reasoning, you should flow chart your whole application before writing any code or tests. Sometimes, looking at the actual logic flow, as opposed to what you think is the actual logic flow, is the only thing that kicks you in the head and wakes you up. Sometimes, it's the only way to get out from the hole of illlogic you've dug yourself into.
"Tests solve that!" he says. No, not really. Why? Tell me you've never made bad or incomplete assumptions in your tests before, and that a walk through the system couldn't help reveal those problems. Tests are good. Looking at code is good. And debugging is good as well. These things are all tools. If you decide that one of them is evil up front, it's a sign that you aren't really thinking through your problems that well. Like any other tool, debugging has a time and a place.
Some of this is simply the disconnect between Smalltalk - and the Smalltalk debugger - and the crappy excuseses for debugging tools that other environments give you. However, a lot of it is testosterone driven I'm so smart that I don't need a debugger nonsense.