سؤال

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?

هل كانت مفيدة؟

المحلول

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.

نصائح أخرى

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.

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.

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!

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.

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.

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.

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.

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.

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.

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

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى softwareengineering.stackexchange
scroll top