Trick for solving extremely nasty programming problems

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'. :)

thirteen comments, already:

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…
xaos - 19 03 08 - 12:30

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.
Marcus (link) - 19 03 08 - 14:33

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.
Steve () (link) - 19 03 08 - 14:39

I often do google before to sleep too
Joilnen - 19 03 08 - 21:59

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…
:)
KIENI - 20 03 08 - 07:29

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

more info at: http://www.google.com/googlegulp/
trunks14 - 21 03 08 - 02:01

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.
buhatkj - 21 03 08 - 23:12

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)
TSM - 22 03 08 - 03:59

I always use that trick, and always works for me, it’s more than magic…

.
dk () (link) - 22 03 08 - 18:57

Yeeeeees it really works! Many of my programming problems were solved while walking or cycling… :-)
kexik () (link) - 22 03 08 - 23:26

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
Varmint () (link) - 23 03 08 - 07:18

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)
MasterGod - 24 03 08 - 13:51

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.
veegun - 24 03 08 - 22:07


Name:  
Remember personal info?
yes
no
Email (optional):
URL (optional):
Enter "layered" (antispam):
Comment:Emoticons / Textile

  ( Register your username / Log in )

Notify: Yes, send me email when someone replies.  

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.
Note: If you type in your email adress above, it will be visible to other visitors, although it will be hidden for bots using javaScript.