Introduction
There are many write-ups on debugging.
I want to be concise and direct to my younger self in this piece.
Listing all things related to debugging.
Mindset
Don’t panic. Bugs happen. They are the inevitable part of programming.
Don’t point fingers. Playing the blame game won’t do any good. Just focus on fixing the problem.
Slow down. Don’t stress. Rushing will make it take longer to solve the bug. To go slow is to go fast.
Be confident. You can solve this. You’re a problem solver. This is just another day for you. The harder the problem, the more you learn.
Error message
Read the error message.
Read it!
Read and try to understand it. What is it trying to tell you? What is the error message saying?
Break the problem down
You feel lost?
Break the problem down into smaller problems. This lets you solve it piece by piece. It’s like a puzzle.
Break it down to a point where you feel like you’ve clarity.
Write down what you understand
Open a notepad.
Write down what you understand.
Write the problem down as if you’re explaining it to a teammate with zero context.
Essentially, doing rubber-ducking. It’s gonna help you understand the problem better.
Focus on understanding
The solution lies in understanding the problem.
Focus on understanding the problem before you try anything. It’s much more productive than trying things.
Although, sometimes it’s good to try different things.
It can help you narrow down the problem.
What assumptions do you have?
What assumptions do you have?
Try to narrow them down. Write down the assumptions you have—even the micro-assumptions.
Assume everything is wrong. Start from the outside. Go in by proving what’s wrong and right. This way, you can narrow down the problem in the right direction.
Use a debugger
Use a debugger.
Go through the process step by step.
By understanding how things change in detail throughout the process, you can narrow down, if not figure out, the problem.
Nice 👌
A problem you understand is a problem half-solved. People often jump back to the editor after seeing an error message and start changing lines based on "what felt wrong, " potentially causing more harm than good.
I'd like to add documenting bugs so that next time they reappear (yes, this happens), you can reopen the issue and see that this has already happened and might require more attention.
nice