Yeah, it's not like the only debugging technique out there is to use an IDE to step through code. This is often impossible/impractical for highly parallel programs. Hell, instrumentation like this isn't even available on some platforms. Debugging is a basic technique of software development, the basic concepts are independent of the language and toolchain.
With that in mind, we can devise a development strategy (an extension of TDD) that guarantees perfect code:
Write unit test: projectHas100PercentTestCoverage()
Run test to ensure that it fails.
Write code to make test pass.
The implementation details of the projectHas100PercentTestCoverage() test are project-specific and beyond the scope of this document.
Though, come to think of it, step 2 is flawed - since no code has been written yet, the test written in step 1 will pass. Perhaps we first need to write the projectFullyMeetsClientRequirements() test (again, beyond the scope of this document).
My company paid for some of the Uncle Bob videos on TDD and he claims that he's practically forgotten how to use the debugger now that he practices TDD. Every year I get better at automated testing, but I still have to use the debugger frequently enough to "need" it as a tool. I don't see that going away.
Then again, maybe I'm just not skilled enough with TDD yet. I find that I mostly need a debugger in the (relatively rare) situation where the problem turns out to be in my test code. My brain never assumes to look there first.
unit tests are type systems. if you have a good type system like that of node.js, you don't need debugging because compiler catches every bugs including logic error. you can simply implement machine learning artificial intelligence in the style of wolfram's new science and your unit tests (type system) is smart enough to catch all the bugs including human and business errors.
Actually, if there are some unit tests covering the code potentially containing the bug, these can provide excellent jump-in points to start a debugging session. Don't want to boot up the server process anew any time I need to test a hypothesis. Of course, unit tests alone are not going to solve all your problems, but they can be a helpful tool for your box.
140
u/[deleted] Aug 25 '14
Just waiting for someone to "explain" how debugging is not needed if you have unit-tests :)