18. Software engineering practiceDebugging
Debugging
Debugging is the process of finding out why software does something different from what you expect, and fixing the real cause rather than the symptom. Good debugging is closer to a science experiment than to guessing: first reproduce the bug reliably, then narrow down where it happens by cutting the problem in half repeatedly (removing code, inputs or recent changes), form a specific hypothesis about the cause, and test it. Tools help, such as logs, debuggers that pause the program to inspect values, and git bisect to find the commit that broke things. The step people skip is verifying the fix and adding a test so the bug can’t quietly return.
In this lesson: Mystery-bug scenarios worked through step by step.