"I consider debuggers to be a drug -- an addiction. Programmers can get into the horrible habit of depending on the debugger instead of on their brain."
Martin's essay reminded me of a fellow I worked for briefly early in my career. He wrote one of the first personal computer database packages (and became rather wealthy as a consequence). When I asked him about his work habits and philosophy, he told me that he'd single-stepped through every instruction in the application at least once. He also said that he didn't see how anyone who called themselves a professional wouldn't do the same.
I've though about that occassionaly over the past few years, as I've noticed that I'm getting a lot done without ever reaching for a debugger. Taking small steps and writing lots of unit tests helps a lot, even when working with languages that don't have safe pointers and built-in garbage collection. Writing the tests first as a way to develop testable APIs shakes out a lot of silliness before it has a change to grow into one of those "what in the heck was I thinking?!?" moments.
Same here... (Score:1)
I've actually noticed a new pattern in my coding style since I started doing TDD. I delete the code I have just written when I unexpectedly fail a test without bothering to figure out what caused the bug - let alone dropping into a debugger. It's quicker to rewrite it correctly than it is to figure out what I did wrong
Good analogy (Score:2)
I never realized how much this influences my coding style until I was recently in front of 30 people at a client location, writing some complex code in real time for them. I'd write three or four lines of code, run the program, then either rewrite those three or four lines if they didn't do what I expect, or I'd write th
Re:Good analogy (Score:2)
I sometimes use a debugger as a way to graphically represent complex data structures that I don't understand and I'm not sure how deeply nested they are (i.e. where print statements won't necessarily work).
But on the whole, yes, they can make you lazy.
Re:Good analogy (Score:1)
In a way it resembles the way of writing HTML: write, save, switch to the browser and reload in a quick sequence.
So using a language which takes longer to compile, like C++ in a lot of cases, breaks the cycle, forcing you to write more and more code to justify a compilation (thereby verifying that you didn't outwit yourself).
Re:Good analogy (Score:2)
It's amazing how comforting it is to know that if you find a problem, changes are really good that you caused it within the last few minutes, and that you only have to take one step back.
Re:Good analogy (Score:1)
I'm think I'm about to get involved in that in the near future, and I'd appreciate any practical tips and tricks.