Trick for solving extremely nasty programming problems

Posted on:March 19 2008

Once in a while, I get to the point where I have to fix a bug or program a solution for a tricky problem and I am simply unable to do this. Simply because the limits of the system or architecture do not allow a clean solution or the bug is that complicated, no matter what I try to do, it won't vanish. Usually, I would sit there for hours, nearly banging my head against the desk trying to solve the problem anyway, and every minute I am spending in front of it I get the feeling the lines of code get blurrier and the solution of problem won't come closer but goes farer away.
I think almost every programmer already came into this situation. One simple trick to solve these situations which always worked for me is the following: Simply stand up, go out of the office and go for a walk. Don't think about the problem anymore and try not even to think about anything programming or work related. After you've reset your mind in this way, get back to the computer and - tada! - in most cases the solution now appears somehow magically. This 'trick' even has proved to be more efficient than postponing the problem to the end of my task list or even 'ignoring it for now'. :)


i guess a related thing is the 'go ask somebody for advice', where on the way to that somebody you realize what the solution is and turn around, leaving the somebody with a puzzled look as to what this was all about...
2008-03-19 12:30:00

I strongly agree with xaos, but not everybody is so lucky to have someone to talk to about programming. Really "talking", not chatting or asking in forums, is a great way to get a look at all possibilities.
2008-03-19 14:33:00

Amen. Sleep is great too - I can't count the times where I've stayed up late trying to fix something, only to go to bed in disgust and somehow the next morning a solution is much more obvious.
2008-03-19 14:39:00

I often do google before to sleep too
2008-03-19 21:59:00

I agree, this is one of the best ways to get rid of this nasty blockades. And now try to tell this a customer, if a deadline is approaching...
2008-03-20 07:29:00

It might be efficient, but way too non-orthodox :)
Might work hmmm....
My approach would be to try Google Gulp

more info at:
2008-03-21 02:01:00

anger clouds the mind and frustration the same thing. its very common, you just need to step away from the damn screen sometimes and let yourself cool off, then when you come back you approach the problem fresh and with a clear mind.
2008-03-21 23:12:00

The Best Solution, if you are a team lead, is to stop working when you run into these problems, check your code in, and email someone under to you that you are overwelmed with paper work and that they need to finish where you left off. When they are done look at the code and find out what they have done and now you are that much smarter without having to do any work. :0)
2008-03-22 03:59:00

I always use that trick, and always works for me, it's more than magic...

2008-03-22 18:57:00

Yeeeeees it really works! Many of my programming problems were solved while walking or cycling... :-)
2008-03-22 23:26:00

Yip I can relate. Walk is always good to clear the head... Thought lately with all the long hours, I've now had two dreams were someone in my dream told me the answer to problem.. I woke up rushed to the computer and it worked!!! :O :P
2008-03-23 07:18:00

Yo Varmint, DREAMING is the ONLY way to solve these problems.
Whenever I have a problem I postpone till the next dream. I always dream my solutions (h)
2008-03-24 13:51:00

I use confessional debugging where you go to a non-tech person and start explaining your problem. Then before the person can reply, the solution comes to you.

I read somewhere that lucid dreaming helps. Where you go to sleep and take over your dream. Then you literally walk/fly through your problem. Then fix the problem as soon as you wake up.

Another one is the super-charged one hour nap. This is where you have two heavy balls (or something similar) in each hand. Sit in a chair. Then doze off. You will be awakened by the balls when they hit the floor. At this precise moment, your brain is super-charged.
2008-03-24 22:07:00

Add comment:

Posted by:

Enter the missing letter in: "I?ternational"




Possible Codes

Feature Code
Link [url] [/url]
Bold [b]bold text[/b]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]