: Figure out why that piece of code is failing. Fix the code : Change the code so it works correctly.
Apply the code change to fix the root cause. Test the solution thoroughly to ensure it works. Verify that the change does not break other parts of the application. Essential Debugging Tools and Techniques
Do not guess. Form a falsifiable hypothesis. : Figure out why that piece of code is failing
If you have a regression (it worked yesterday, it fails today), do not read every file. Comment out half the codebase. If the bug disappears, the bug is in the half you removed. If it remains, it's in the running half. Repeat. This binary search on source code compresses hours of reading into minutes of binary elimination.
To "complete POST" (Power-On Self-Test), a computer's motherboard must successfully initialize all core hardware components—CPU, RAM, and GPU—before handing control over to the operating system. Core Requirements to Complete POST Test the solution thoroughly to ensure it works
When you have a long execution path and the bug could be anywhere, manually stepping through everything is tedious. Instead, use a binary search approach: find a midpoint in the execution (e.g., after half the processing) and verify if the state is correct. If it is, the bug lies in the second half; if not, it’s in the first half. Repeat. This technique drastically reduces the number of locations you need to inspect.
: Look through your code to find the exact line causing trouble. Form a falsifiable hypothesis
These bugs cause a program to terminate abnormally while running. Common examples include dividing by zero, dereferencing a null pointer, or exceeding the bounds of an array. Logic Errors