Banging your head against your keyboard, drinking more and more coffee or simply losing interest and surfing the web are the worst things to do when stuck in programming.
The problem is, these reactions are the default for too many people in the industry. It not only doesn’t help the project you are working on, it also doesn’t do your body any favours by increasing stress levels.
The best thing to do when stuck is to stop, un-plug, and come back to the problem later with a fresh mind and fresh eyes. Believe me I have been there and it really does work. Here are some easy techniques to help you become un-stuck.
Talk to those around you
If you are at the stage where you have been stuck for a while, and find yourself browsing the best family tents or looking through the Consumer Tent Guide, it is obvious your mind has strayed to leisure activities outside work and not the problem at hand.
The best step now is to leave your desk and walk away from the room you are working in. Find a co-worker that is not a programmer (or a family member if you are working from home) and try to explain to them in simple terms your problem. Often, by having to explain the problem out simply, you may stumble upon a solution. And it is always good to have a break and joke with others around you rather than stress on your own at your desk.
Go to the pub
No, seriously. Or go to anywhere where you can relax and escape your temporary problem (and you really must think of it as temporary, as it will be resolved. No need to panic). Obviously if you are at work, use your break to freshen your mind and leave the office. If you are working from home, take a trip down to your local and try not to stress about your hiccup with work.
Often, when we return to a problem with fresh eyes, we can see things from whole new perspectives, or look at things in ways we never thought about before.
Take a nap
Well, not suddenly, but if you have taken that 20-minute break and your mind is still blank upon returning, the best thing is to probably tackle the problem the next day. So start working on something else while still at work so you can remain efficient in your job. Now go home, and sleep without stressing about your initial problem. Chances are the good night’s sleep will help you find a solution.