20

It happens to most of us, I'm sure. We've sat down to work on a problem, only to forget about dinner, then breakfast, and sometimes lunch. "Two minutes" often becomes "until 2 A.M." and then when we finally take a break and we find ourselves continuing to work on the same code, or worse. At what point do you know to stop and do something else (and what do you do)?

I mostly ask this because I recently found myself thinking something to the effect of:

Faucet.turn();
try
{
    Drain.releaseWater();
}
catch( Exception e )
{
    try
    {
        Plunger.pump( Drain );
        Drain.releaseWater();
    }
    catch( Exception e )
    {
        Errands.push( GroceryStore.purchase( LiquidPlumber ) );
    }
}

I am spending my spare time reading a book now.

33 accepted

Go outside without your phone. Take a long walk. Listen to the birds. Watch children play. See what shapes you can find in the clouds. Smile.

18

Usually pain is my clue. Here's a translation matrix:

  • Abdominal pain - Severe hunger. You have missed one or more meals. Get something to eat.
  • Back pain - You have been sitting too long. Stand up and walk around.
  • Eye pain - You have been staring at the computer screen too long. Take a break and focus on objects at a different distance from your face.
  • Head pain - You have a headache. You need relax in a manner other than through programming.
8

I know I've been programming too long when I start to think about the implementation details of the games I'm playing rather than, you know, enjoying them.

I once got into a somewhat heated discussion about database optimizations in World of Warcraft and, well, my group wiped because I wasn't paying attention.

I blamed it on the healer, of course.

6

Perhaps it's sad, but that never happens to me. I have the opposite problem - there are too many distractions, and I'm never allowed enough time to get into the zone to the point where I'm unaware of time passing.

5

I once had a dream that I was caught in a while loop and couldn't meet the exit condition. That was when I knew I needed a significant vacation. I took two weeks away from the interwebs and that did the trick.

5

Micro sleeps. You suddenly realise your brain has turned itself off and you've been asleep in your chair for seconds or minutes. You shake your head and say "I won't do that again' then you immediately fall asleep again and repeat the process.

4

If I see Ruby or C# code in my sleep, I try to cool it the next day. I've had dreams where I had programmed and debugged, waking up not at all rested.

On the other hand, during those times, I've solved a few problems that I couldn't solve awake.

3

I know I've been coding too long when I sit down for a few minutes to fix something, and look up after a short while... only to notice it's the following day.

Also, many years ago I remember sitting on a slow-moving bus, and wondering if I could change the variable to make it go faster...

3

When I start pressing the rebuild all button just to get a break.

2

It happens to most of us, I'm sure. We've sat down to work on a problem, only to forget about dinner, then breakfast, and sometimes lunch. "Two minutes" often becomes "until 2 A.M." and then when we finally take a break and we find ourselves continuing to work on the same code, or worse. At what point do you know to stop and do something else (and what do you do)?

I don't know about you, but I try to avoid situations like that. Skipping meals and repeated grinding lowers your productivity. Whenever I'm stuck at a point where I can't seem to make progress, then I take a quick break to refresh myself.

2

If you feel mentally exhausted/fatigued or you're sleeping and seeing code scroll you've programmed to much and need to relax or have a slower day.

2

When I'm starting to get solutions does not make sense and find myself rambling for a while.

2

Last week I lost track of time while working on a time tracking system...

1

I generally know when it's been too long when I start making stupid mistakes that I normally wouldn't make. Things like spelling errors that cause the code not to compile, forgetting what arguments go to which functions/methods, forgetting to properly test new code being written, etc. Usually this coincides with my girlfriend stumbling into the room asking when I'm coming to bed. That's when I know it's time to save my work and call it quits.

1

I once was working on a project that required xml schema validation. We were having a lot of trouble getting the xml to validate and we spent days debugging it. At one point I finally went to get some sleep. One of our cats knocked something off the table and my wife woke up and asked me if I had heard something, I replied "That's not going to validate with the schema."

I make sure to spend time away from developing now, especially before I go to sleep.

1

You want to quit. Seriously. This works for me: if I'm ever in the situation where I feel that programming has become a chore (not just one program or one piece of a program, but programming in general), then I know it is time to sit back an read a book...

0

+1 to @duffymo... I'm the same boat.

However, when I was finding uninterrupted time, my first clue to stop was when the second-to-last person in the office reminded me to lock the door (she was a 7:30-8:00PM departure).

Also, whenever I'm hungry I stop and enjoy a meal.

0

When you vote down seemingly silly questions asked by beginners on StackOverflow...

0

Normally I don't skip meals unless I'm really in the zone. I find hunger ruins my level of concentration to the point where I have trouble focusing. I try to schedule a break every hour, even if it's just getting up and walking to get more coffee or get a snack. If it wasn't so cold I'd take walks outside to clear my mind.

0

I'm always torn between music and code - there's just not enough hours in my day. So, if one is not flowing I'll just swap to the other. When I come back, I'm always 'unblocked' :)

0

I find that I've been at a particular problem to long when I start implementing it in another language in my sleep. The natural extension of this is that every time the alarm goes off the implementation has crashed and I need to hit snooze so that I can debug.

0

when you think to yourself you have to reset the coffee cup to 0, but actually you intend on washing it

0

Last year I took a few months off. During that time I was very sucessful at doing NOTHING. It was fantastic.

0

You're sitting in programming, your wife comes in and asks you something and you.... you can't understand where she comes from and what she's doing in your room.

Stop coding. Look at her. Talk to her. Remember there is life beyond computers (it's sound strange I know).

0

I haven't had that problem much in recent years. I've found that owning a home does wonders to keep you from spending too much time coding (sometimes to my disappointment). There's always something around the house and/or yard to take up what would otherwise be free time. This last week has seen me spending 8-10 hours just shoveling snow.