Bike ride as a debugger
The single most reliable debugging tool I own is a motorcycle.
When a bug refuses to budge, I stop looking at the screen, take the bike out, and go for a ride.
The first 10 minutes are usually spent replaying the code in my head. Then I start blaming the framework. After that, I blame the database. Sometimes I blame the developer who wrote the code, only to remember it was me.
Then somewhere during the ride, usually when I am not even thinking about the problem anymore, the answer suddenly appears.
“Oh. That variable is getting overwritten.”
“Oh. Wrong environment.”
“Oh. I am looking at the wrong logs.”
I get back home, make a one line change, and magically everything starts working.
I have no idea why this happens.
At this point I have stopped trying to understand it.
All I know is that after spending 2 hours unsuccessfully debugging at my desk, the solution somehow appears while I am riding through traffic, waiting at a signal, or stopping for a tea.
So whenever a bug gets too stubborn, I don’t open another debugging tool.
I just take the bike out.
It has a surprisingly high bug fix rate.