Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I keep reading that it is recommended for a programmer to take frequent breaks while programming, and the usual recommendation I see is 5 minutes every half hour or 10 minutes every hour.

I gave it a try, but quite often I find something interesting during those 5 minutes, and it takes me away from what I was working on for longer than I planned. Either that, or my mind gets focused on something else and I find it hard to get back into my work and don't focus very well.

Is it really that beneficial to take frequent breaks while programming? Am I doing something wrong for it to be decreasing my productivity instead of increasing it?

share|improve this question
    
Have a look at 5 Minute Break, it reminds you of breaks by splashing in full screen and you can't miss that, and it's scary. –  Czarek Tomczak Feb 23 '12 at 17:11
    
@CzarekTomczak That would drive me crazy, especially if I was in the middle of something :) –  Rachel Feb 23 '12 at 17:30
    
AS you get older this becomes all to necessary, it is simply not health to sit for long periods of time or type for long periods of time –  jk. Feb 29 '12 at 10:20
    
Drink a lot of water or start smoking... Then you will have your mind firmly set on what you need to do in your breaks. –  user1249 Apr 29 '12 at 13:48

13 Answers 13

up vote 34 down vote accepted

I do take frequent breaks but they normally have a purpose (bathroom, food/coffee, etc). I tend to find that while I am away from my desk that I am still thinking of the problem at hand. However, this thinking is not distracted by the code in front of me and allows me to think more about the problem as a whole rather than nitpicking through details in front of me. Frequently when I return to my desk I have a new idea at how to approach the issue I am working on.

share|improve this answer
    
Yes, for me "taking a break" is pretty much synonymous with "grabbing a drink" or "going to the bathroom" or something. I typically get up from my desk every hour or so. It's also important to look around every now and then so your eyes can focus on something that's not 1 metre in front of your face... –  Dean Harding Nov 4 '10 at 5:37
5  
I agree with this but just to clarify, when people talk about "taking a break", it is a physical break not a mental break. If you mentally break from what you are doing you will often have the problem the OP has. You will get lost in another activity for longer than the 5/10 minutes. –  Nemi Nov 4 '10 at 18:01

Yes, best ideas always are income when you have a BREAK like smoking cigarettes or driving a car.

share|improve this answer
    
+1 for fitting in going for a drive in your lunch break... :) –  Anonymous Type Jan 16 '11 at 23:16

Taking frequent breaks is VERY important for your health. I read that people who sit down or lay down watching TV even just for a couple of hours have increased risk of mortality even if you exercise. You just HAVE to keep moving around.

"A new study from American Cancer Society researchers finds it's not just how much physical activity you get, but how much time you spend sitting that can affect your risk of death. Researchers say time spent sitting was independently associated with total mortality, regardless of physical activity level."

http://www.sciencedaily.com/releases/2010/07/100722102039.htm

"Couch potatoes beware: every hour of television watched per day may increase the risk of dying earlier from cardiovascular disease, according to research reported in Circulation: Journal of the American Heart Association."

http://www.sciencedaily.com/releases/2010/01/100111161927.htm

share|improve this answer

Not only is it beneficial to your productivity to take frequent breaks it is also beneficial to your health. 10 years ago I had a Pulmonary Embolism (blood clots in my lungs) from working too long without breaks. I fortunately recovered from that and thought I was doing really good. Last April I got into a coding sprint for a couple of days. The kind where time flies by and before you know it you've been sitting way too long. I found myself extremely short of breath and when I went to the hospital I had a new batch of blood clots.

I'm back to setting alarms and walking around every hour.

share|improve this answer
2  
+1 for pointing out the real life effects of sitting still for too long. good on you and I hope you have had a full recovery. –  Anonymous Type Jan 16 '11 at 23:18

If you're really stuck, sometimes instead of taking a break, you can release your rage and break a take, like the teeth of the annoying co-worker who is distracting you by babbling loudly on the phone to all of his living relatives back in the hole he crawled out from and into the urban areas.

share|improve this answer

I take a break by moving to the kitchen, then opening the refrigerator, then close it, then go back to computer. It happens when I'm mind-stuck

share|improve this answer

I think it really depends on the task you are working on. Sometimes I find a 5-10 minute break to clear my thoughts and stretch/walk about can really be beneficial. Other times I will leave my desk and come back and my code will look almost alien to me as my train of thought has jumped.

Generally speaking I say good thing, but I would disagree with using an app like @Pierre suggested, I tried something similar before and found it frustrating.

share|improve this answer

Absolutely. I'm an advocate of the Pomodoro technique, the most general implementation of which is 25 minutes on, 5 minutes off. A pomodoro is atomic, so you can't do half of one. This forces you to sit and think through a problem without wandering off to gmail or SO. Conversely, you're also forced to get up every twenty five minutes and walk around or do something non-job related (I occasionally violate this if I'm deep in a problem).

I've been doing this for about half a year and find that the "head down coding for hours" myth is largely that, a myth. I'm more productive, and generally spend less time dealing with stupid problems (E.g. today I typed [] instead of () when trying to invoke a javascript function) when I force myself to stop every 25 minutes.

share|improve this answer

How productive will you be if you go blind from staring at the monitor for too long or have a mental breakdown from working nonstop? Personally, I'd worry more about actually going blind or having a breakdown, but it sounds like you're more worried about the productivity standpoint.

Now to be fair, a 5 minute break every 30 minutes sounds a bit on the excessive side. But I don't recommend skipping out on breaks because it makes you less productive in the short term.

share|improve this answer

I find the option of frequent breaks very helpful. If I'm neck-deep in a task rolling along, I might go hours without a break. I would certainly find a forced break very disruptive.

If I'm working on code that just isn't behaving, walking around for a few minutes lets my brain wander "around" the problem enough to give an insight to the problem.

I often joke that my best thinking for the job goes in in the company's bathroom, but it's only half-kidding.

share|improve this answer

I do 10 minutes breaks every 45 minutes of computer work.

During the 10 minutes, I walk, prepare a coffee and such trivial stuff. Sometimes, I take the time to clean my desk. But it has to be trivial things.

I use workrave to remind me when to stop.

What you do is actually task-switching. Your brain can't rest and start on something else when unfocused from the previous thing.

I'm currently trying what is called mindfulness. It works so well it is scary!

share|improve this answer
    
I am not sure about using a program to remind you to stop as I find it distracting but I am very keen to know more about mindfulness, do you have any resources on how you could adapt the technique into a working situation? –  Toby Nov 3 '10 at 19:59
2  
I looked at WorkRave once before but I didn't like having something telling me to stop when I'm on a roll and breaking my concentration –  Rachel Nov 3 '10 at 20:05
    
Toby, it is not so distracting if you follow the rules you set to yourself. Regarding mindfulness, it is used in conjonction with cbt. I suggest you to buy the book of this author:mindfullivingprograms.com/whatMBSR.php the book is called "full catastrophe living" –  user2567 Nov 3 '10 at 20:08
    
Rachel: you can set the rules you like. –  user2567 Nov 3 '10 at 20:09
1  
Mindfulness practices have done wonders for me, and everybody I know who's seriously tried them. –  Bob Murphy Nov 3 '10 at 23:31

It is completely dependent on your current state. If I'm stuck hard on something I'll flip over to Programmers.SE or SO and check some questions. I'll get up and go for a walk. Maybe get a soda or a slice of pizza.

If I'm in a groove I'm not going to be stopping. Breaks are beneficial when left up to the programmers judgement.

share|improve this answer
2  
Programmers.SE/SO is part of my problem I think... taking a few minutes to browse the questions normally leads to a longer time spent answering a question. –  Rachel Nov 3 '10 at 20:03
4  
+1: When in 'the zone' breaks aren't part of the equation. You just end up looking away 3 hrs later and thinking "hmm... missed lunch" –  Steve Evers Nov 3 '10 at 20:27
    
@Rachel: I tap into the feed for questions so I don't waste time refreshing hoping there are new ones. Can't do the SO feed though, otherwise I get 30 questions every five minutes. –  Josh K Nov 3 '10 at 20:33
    
@SnOrfus: I just got back from lunch. ;) –  Josh K Nov 3 '10 at 20:33
3  
+1: That's pretty much my experience too: taking frequent break is beneficial but only when you're stuck. If you're wasting precious "in the zone" time to take a break you loose productivity, not gain it. The point is that when you're stuck, trying too hard often will not help you (but only when the too part is present, nothing is wrong with just trying hard) and taking break will then helps. Also, listen to your body, if you're hungry, take the time to go eat a light snack or else it is very distracting (but well, again, if you're in the zone, you can postpone it a little). –  n1ckp Nov 3 '10 at 22:25

Personally, I don't find a 5 minute break at my desk of any real value. I'll get up and walk around instead and then come back and attack again with renewed vigor. I'm also not real strict about the timing... if I'm on a roll, I definitely don't stop. If I'm stuck, I stop before I get too frustrated.

share|improve this answer
    
Yep. Some crunches or pushups are nice. So is tidying up. –  Bob Murphy Nov 3 '10 at 23:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.