Which sessions of work are more productive for programming: short (<= 30 minutes), mid-length or long (>= 2 hours)? In which cases? (Consider coding new functionality, doing small modifications, tweaking UI, refactoring, debugging, learning API, trying to understand other's code).What can you tell from your experiences? Information from studies and best practices are also very welcome. Though it would be nice to see links or references.Reliable information is prefered over complete answer.Valuable takeaways:Focused thinking is the ultimate target hereGenerally uninterrupted work > 2-3 hours yields loosing focus and foggy thoughtsWhen you are in flow, it's better to let yourself to work for 1-2 hoursIt worth to try practicing Pomodoro Technique, for helping to overcome thinking inertia and procrastination, to get better feeling of time. Especially it can help to start doing things that you don't like doing that muchWhen using 'break management' software, you can allow yourself to be more flexible, e.g. to skip 1 break but not more. This allows you to adopt to the situation: be in flow, when there is a flow, stay manageable when are not in flowFresh air, relaxing and excercises during break can help to get involved right hemisphere to get new ideas and solutionsTry software tools for 'break management':Pomodairo - it additionally tracks list of tasks and has pice UIWorkRave - provides more flexibility in configuring. also usable without speakers
What work intervals are more productive: short or long?
productivity;time management
I believe the most important thing is to really focus. Focused 5 minutes can be more productive than unfocused 5 hours tinkering, surfing at stack exchange sites, chatting, etc. If you're really focused, you can't go on for hours continuously (if you can, then you're not really focused). Your brain will just run out of fuel. Indeed, most productivity / time management techniques, such as the Pomodoro Technique, are all about:Breaking your goals into small, accomplishable tasks.Taking one task at a time, focusing on it and only on it, for a timeboxed amount of time.Taking at least a short break.When doing something difficult, the warm-up time - loading all the information into your brain and understanding the problem - can be fairly long, so arbitrarily short periods aren't productive and the optimum uninterrupted period depends on the difficulty level of the task. But anything >> 2 hours is just stupid. Getting up from your chair for 5 minutes and getting some fresh air will save hours, as you'll come up with the solution that you've been trying to figure out for the last 2 hours.More about Pomodoro Technique, as requested by Alexey: I have tried it, actually it's the only formalized time-management method I've ever tried as is.  It was a beneficial experiment which helped me to value timeboxing, and I could still use it especially if I have trouble in starting up. However, when in flow, I found pure Pomodoro - pause every 25 minutes - too stiff. Pausing just because of some precise, predefined time is up feels waste. The ringing timer is a distraction, and it does make the mental pieces fall down, and re-building your brain cache after the break takes time.So nowadays I'm mostly working just according to the current situation. If I have trouble starting to do something, then I might set a strict goal, for example do this for the next 30 minutes, period, or complete this before getting more coffee. Such simple rules make  self-discipline easier. But if I'm full of energy, doing some fine code, then I might do it for almost 2 hours straight, without interruptions. After such a sprint my brain runs out of energy, so pausing for a while happens of necessity anyway.But just to be clear, I think my ability to work according to the current situation is largely because I have tried timeboxing, even though I rarely do strict timeboxing any more. Thanks to the trial, I know that when I'm procrastinating, then I'll make some kind of timebox - one box is often enough - and soon I'm in the flow again. So I highly recommend trying such techniques. Even if you don't end up using it all the time, you'll likely learn some useful tools to control yourself when needed.