While one major use of the debugger is already covered in AskTheCode
, perhaps UseTheDebugger
might refer to the technique of proactively stepping through newly-written code with the debugger to make sure right then and there that it is actually doing what you think it is doing.
Even if the code passes the UnitTest
that you've thoughtfully provided by using CodeUnitTestFirst
, it doesn't necessarily follow that the code is correct, only that it passes a single unit test; stepping through the code could still be enlightening.
This technique is advocated by SteveMaguire
, a former Microsoft developer, in his book WritingSolidCode
. (He also has another interesting book called Debugging the Development Process
XP developers may think that they should ForgetTheDebugger
. But, if you use "assert" statements in your code, the debugger can really be your friend; it can stop the program right where things are going wrong, and give you a chance to see what's gone off.
Also, if you can change code while debugging, it can help you achieve JustInTimeDevelopment?
- helping you CodeUnitTestFirst
, as when they fail, you can change/write code right there, and press "go" to continue.
Coding in the debugger can be done (more or less) in...
Stepping through code in the debugger is also an excellent way to learn how your language works. The learning curve to internalise an unfamiliar language that you can't step through is much longer. -- DominicCronin
See also ForgetTheDebugger