views:

237

answers:

6

I usually find that after a couple of hours "in the zone", I need to take a break, get some fresh air and get a new perspective. Often, these breaks allow me to generate a solution to some stumbling block that was preventing progress. If, instead, I continue to pound at the code, I start to get sloppy, make mistakes and get more and more frustrated, which leads to a vicious cycle whereby I get almost no productive work done.

I maintain that some of my best work is done during my lunch break, when there is no computer in sight.

What are your experiences with optimal lengths of coding sessions and how do you structure your time to achieve this?

A: 

My sessions can last for hours. I've had full day sessions from 9am till like 1am. Although not lately I must admit. I agree about the slopy-ness sometimes, but there's nothing like a 10 hour "zone".

[edit]Slim: Not too sure what 10 hours of coding has to do with architecture and design? Most of my projects have been well into 100's of hours of work and when I'm in the zone I see myself doing more work in those 10 hours than when not. Also, I wouldn't call it a "frenzy." In the zone just means I can hold my concentration and my understanding of the task at hand.[/edit]

Mladen Mihajlovic
+1  A: 

Like almost any other question on SO; it depends. When i'm struggling with a really difficult thing, it might cost so much energy and concentration that I need a 10 minute break every hour. On the other hand, When I'm making good and fast project and basically having fun, I can go on for 4,5 or 6 hours on end.

Rik
A: 

It largely depends on your biorhythm. Some people are active in the morning, some at the eventing. Taking small breaks is a must. Periodic breaks can help you to deal with workload.

Actually this question is very subjective and good candidate to be closed :)

aku
+7  A: 

I think breaks are essential. Get away from the problem and allow your mind to wander. I cannot count the number of times I've wrestled for hours with a problem, given up, gone home and came back in the morning and solved it within minutes.

There comes a time (at least for me) when staying at the computer becomes counter-productive. It makes sense to walk away - for a time. I would go as far as to say that you cannot produce good code at the end of a 6-7 hour intense coding session.

paul
A: 

One way to structure your time to achieve this, is to take regular breaks from coding while still doing other work, such as documenting your work, answering e-mails, or just doing any other work that is not coding.

This way you can make your problem-solving brain-task run in the background while still getting things done. That being said, a real break such as a lunch break or a short walk outside is often necessary too.

Einar
+2  A: 

Since I started doing it for a living - no more than 3 hours actually sat at a keyboard. It's a policy not to skip lunch breaks, or to stay more than an hour late.

Of course, one is often designing in the background. My some of my best design insights have come while pondering a problem in bed, or while discussing something over drinks.

I don't know about other people, but if I were to hunker down to a ten hour coding frenzy, it would probably mean I hadn't designed the thing right in the first place.

slim