As Software Engineers, we constantly deal with bugs. Some are simple to fix and some are so elusive that you would be breaking your head for weeks and still not solve it.
Here are 3 unconventional debugging techniques I routinely use and the best part is it doesn't require learning any new tools or software.
1. Rubber Duck Debugging
This technique is a reference to a story in the book The Pragmatic Programmer. Here are the steps to do Rubber Duck Debugging
Buy a Rubber Duck (if you hate birds, you can choose a different animal toy).
Explain the problematic parts of the code, line-by-line to the duck.
There's no step 3.
Describing what the code is supposed to do vs observing what the code actually does helps in making the problem clear.
Tip: It doesn't have to be inanimate objects. You can talk to your pets or family or even random strangers if they are willing to listen.
2. Get Up and Walk
Sometimes you would get frustrated with the bug, literally stuck with it, running around in circles with no solution in sight.
When you feel no amount of Rubber Duck Debugging helps, just get up and walk around the block.
When you step out of your work zone and go for even a 5-minute walk, your mind recognizes the change in scenery and tries to help you solve the problem.
Tip: Sometimes a shower would also help instead of a walk.
3. Sleep it off
When both these techniques don't help, maybe your brain is too tired to process things and needs a rest.
Stop worrying about it and instead go sleep. Even a short 30 minute nap helps a lot.
There have been many times I have slept off below my desk at work and woken up fresh and debugged the problem in 5 minutes.
Tip: As soon as you get the solution, even if it's in a dream, wake up and go straight to solving it. It's easy to forget things after a while.