Sometimes Programming Is Like Playing an Adventure Game


Image from the legendary adventure game Monkey Island 2 – remember to visit Grumpy Gamer – The personal blog of Monkey Island creator, Ron Gilbert. Fine place for adventure gamers is justadventure.com, check that as well.

Recently I had coded for several hours and it was 6 pm. I had just finished a piece of SQL code and it seemed to work… until I noticed that DELETE record was not working, but there was no error message.

I made the every possible thing I could imagine:
- double checked the query string – was ok
- checked the field names in db several times… all okay
- I added debug info… everything seemed ok
- I searched for any error… nothing – all was ok
- I went through all the variables… no errors there
- I cursed (didn’t help)
- I repeated all this over and over and tried to tweak something here and there… didn’t work.

I decided to finish for the day. I had woke up at 6 am and I was bit tired. I decided to continue tomorrow.

The next day it took me about 1 minute to locate the error. I made a simple test (used bit different variable content) and it was there. The error was not in the syntax, but in the content.

I’ve noticed same thing happen me years ago when I played lots of adventure games. I had played the game for hours and tried to find the solution for the problem, but without any luck. But… after a night’s sleep and with fresh brain – the solution is apparent. I recommend you to do the same: If sometimes you feel you cannot solve a problem and you feel tired – go to sleep and let your brain solve the problem while at sleep. It just might work.

12 thoughts on “Sometimes Programming Is Like Playing an Adventure Game

  1. Tuna

    Happens to me all the time. I get hope get to work on my game and I’ll be in the middle of a relatively complex scenario and be baffled by an error I’m getting. Go to sleep, go to work, come home, look at my code and its right there. Almost like having somebody else in the room to overlook your code – just have to wait a day for them to finish looking at it, lol.

    Reply
  2. overklokan

    its called fatigue and only way to remove it is to remove the
    source that is creating it … sleep is one of the best methods

    Reply
  3. Sakura Games

    Very true what you say. I usually take a break every 2-3h even if I’m not stuck. It works better than coding 7h straight. And if I am really stuck, I go out to do a walking and usually when I get back I find the solution in less than 10 minutes…

    Reply
  4. Fran

    Yes! This is why I prefer working shorter periods for 7 days a week rather than longer periods for 5 days a week. If I don’t find a solution quickly, I shelf the problem until the next day, and having 7 chances to do this works out better than 5.

    Reply
  5. GBGames

    Particle effects. I couldn’t think of the term when I was writing about game development yesterday. It was late at night and it took me a minute of trying to clear my head before I finally managed to think of the words. This morning, walking towards the train, it popped into my mind easily. It’s annoying when your mind is clouded, but especially when you’re working on something.

    Reply
  6. Mike

    Yeah it’s like pixel hunting ! :)
    I remember once I struggled with a piece of code for the whole day. I went to sleep and when I woke up in the morning, more precisely – in the state when you’re not really awaken but you know you are awake (makes sense?), the code just visualized before my eyes. Every single detail was there. I immediately turned on the computer typed the thing and it worked 100% without any error.

    Reply
  7. Twist

    This is good advice unless you have an obsessive personality. I have hit the coding wall like this before and the problem has chased me into my sleep. Dreaming about code just isn’t much fun. Of course when you wake up the next morning and immediately see the problem it is worth it I guess.

    Reply
  8. n/a

    Or do something else. When you are looking same problem too long, you end up with locked mindset about that problem and it’s hard to see “outside that mental box”. So, do something else for a while.

    Reply
  9. Ville

    The problem with that approach is that you’d need to take a night’s sleep every few hours as problems come along. :D

    Reply

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Pro-Human Quiz: