Solve stubborn bugs faster by breaking things on purpose, questioning your assumptions, and thinking your way to clarity.
Bugs show up, eat all your time, and gaslight you into thinking you are the problem. You’re not.
You just solved that problem a few commits ago, but now it’s harvest season again.
Here are some debugging hacks that worked for me during such times:
1. Stop blaming the code: examine your assumptions instead
Half the bugs you chase aren’t in your code. They’re in your head. You assume the API returns the right format. You assume the config is loading. You assume that “of course that condition can never be false.”
Pause. Write down 3 things you’re assuming. Then test if they’re true. Most bugs die here.
2. Use print statements whenever possible
Yes, logs are good. But sometimes what you need is a print statement that shows the raw, brutal truth.
Forget “elegant” logs. Instead, write: console.log('IT GOT HERE', value, otherValue);
... continue reading