views:

475

answers:

23

I noticed it's more and more frequent for me. 5 minutes is probably the longest i can go without checking facebook, or this site, or youtube, etc.

What do you do to keep your attention focused on the task, and how long does it last?

A: 

shut down my browser. i then need two clicks to satisfy my urge to wonder.

akf
At one point I removed Firefox from my dock so I had to find it in the Applications folder before I could surf.
too much php
I tried this strategy (and also shutting down my network in the mac as it takes a while to restore). I found out that while effective in the short run, when I do get back on the web I "pay it back" tenfold.
Uri
+3  A: 

If I get into the zone, I can go for several hours.

Getting into the zone is another matter entirely. Sometimes I need to focus on something else for awhile while my mind sorts the problem.

Music helps sometimes. Coffee helps too, if I don't drink too much.

Robert Harvey
Yes, getting into the zone is a different matter. I can't drink coffee, though, as it gets me agitated, and i start singing/listening to music and it makes it even worse.
lyrae
+4  A: 

5 minutes is a very short time, I wouldn't get anything done if I could only concentrate for a few minutes at a time. I'll try to spend at least a couple of hours at the time for working before I spend any time on tasks that are not directly work related.

See What tricks do you use to get yourself “in the zone”? for some tips on how to get into the zone.

Jonas Pegerfalk
Great link. I'm browsing through it right now
lyrae
Interesting read.
Kareem
+2  A: 

There's some good points in the book "The Productive Programmer" by Neal Ford, he suggests amongst other things:

  • Blocking out visual and audible distractions (use Headphones, you don't have to use them to listen to music).
  • Turn off notification in the O/S. Email/IM/Twitter.

etc... See:

http://www.amazon.com/Productive-Programmer-Theory-Practice-OReilly/dp/0596519788/ref=sr_1_1?ie=UTF8&s=books&qid=1245127079&sr=8-1

Jon
+6  A: 

For me, it depends on how interested I am in what I'm doing. Personally, I do my best to work on things that I'm passionate about or interested in developing. When this is the case, usually I'm personally driven to the goals of the project, and do everything I can to reach the final outcome, and when I do, I personally feel rewarded by what I've created.

If it's something that you have no control over doing, then I can understand how you could be easily distracted, as I am sometimes as well. However you should try your best to reach out to development areas that you're personally interested in. When you truly enjoy what you do, I find that in my spare time that I'm distracted not by facebook, but by programming.

Ian Elliott
very good advise, only if everyone get to do only they're passionate about. i think you are lucky in this regard
ala
+1  A: 

All depends on a person's will-power. Make a habit to manage your time properly. Make sure to finish the task at hand before having a peek at SO again. Maybe spending 10 mins per 2 hours is not a bad idea. Or in between if you are stuck somewhere and need to post a question. If you are lookin at other sites every 5 mins, you wont be able to be productive at your tasks at hand.

ThatDotNetGirl
+1  A: 

I set up a stopwatch with the goal of having N number of hours of focused work throughout the day (obviously it depends on how many available hours I have for programming/studying throughout the day).

I stop it each time I get distracted.

I don't care about breaks, but I do care about achieving my "effort-goal", usually 2 to 3 hours per day.

So far, this has worked better for me than any other mindtrick I've played on myself. I wish I could gather willpower for more hours of focused work per day, but I have never lasted more than 5 and some days I've trouble meeting up my minimum of two.

omgzor
A: 

Depends on the task, when i have an interessting "problem" iam able to code 1 - 2 Hours without any break. On boring tasks i will take a break every 20 Minutes.

But i think thats always ok, coding is not a job like others, there are other rules ;)

ArneRie
A: 

When the mood hits, I start coding at 9:00 a.m. and I look up after a few minutes and it's 9:00 p.m. Other times, I walk around, drink coffee, check email until things crystallize in my mind and then it's on again.

How can you get any coding task done in 5 minute chunks? This is why companies block facebook! :)

JP Alioto
I'm like you. My wife gets so mad when I show up at 9PM because I just didn't look at the clock and never realized 12 hours had passed.
Josh Einstein
A: 

A quite and calm environment with no bustle is a good fundament. Likewise rudimentary is adequate equipment, FREE bandwidth, switched off phones and no one looking over my shoulder. Also very important for me is enough food & drinks near by and not many other tasks on the "stack". Did I mention not having fixed rituals - eq. kitchen/floor meetings - helps A LOT?

merkuro
+1  A: 

You sound bored.

The idea of going for only 5 minutes before getting distracted is not something I can relate to.

When I'm in the zone I lose hours at a time. I miss meals - often more than one. My wife will kick me and say "walk around before you get a blood clot"

Most days I'll slip into this mode for stretchs of 3-5 hours. When I'm working a death march it might be 8-10 hours.

When I'm pairing it is more common to go about 2 hours before we take a few minutes - but it's not Facebook and youtube. It's bio-breaks and grabbing caffine or water.

Bubbafat
A: 

Once I'm in the zone, nothing can distract ... hey, look at that chicken go.

paxdiablo
+1  A: 

Been on Adderall for 3 years or so (every time I mention that I get downvoted) and have never been better. I occasionally still drift off but I've found that usually when I get distracted now, I am distracted with other code. Sometimes I waste too much time writing things like collection classes or some kickass general purpose IComparer but it's better than ... oh look a pretty bird!

Josh Einstein
+1  A: 

As some others hinted, my problem, if anything, is the reverse -- if there are no external distractions (I'm at home and my wife and the kid are elsewhere, or I'm at the office at night or on a weekend), and the problem I'm wrestling with is really interesting (debugging most especially, but coding and testing and fine-tuning algorithms and optimizing and profiling aren't far, and writing in-depth essays and chapters of books is close too), time just disappears...

I'm liable to look up, get surprised by finding out it's dark outside, suddenly acknowledge pangs of hunger that I'd been apparently suppressing for a while, and have to grab and gulp down a low-carb, high-protein bar (I keep a supply in my laptop bag that never leaves my side, it's important to avoid sudden blood-sugar crashes!) to give me the energy to go prep ramen noodles, or a P&B sandwich, and coffee or at least a high-caffeine, no-sugar soda (maybe after a rushed visit to the facilities, too...).

The risk is worse at home - at work, I'll typically break every hour or two for a cigarette (albeit carrying my laptop to keep at it -- it's still a break of concentration and will remind me of any other physiological urges!-), but at home I could be on my laptop in the patio or backyard all the time, so my addiction to cigarettes need not imply a break.

I'm told these are symptoms of autistic-spectrum syndrome, which is peculiar because I have no other signs of it whatsoever... but it's certainly the opposite pole from the ADHD signs that are mostly being discussed here;-).

Alex Martelli
+8  A: 

Each time I visit facebook, S.O., reddit, etc, it increases my distractability for the rest of the day. If I can stay off them until lunch time, I will be productive until then. If I stay off them until 5PM, I will be productive all day. If I visit facebook and S.O. in the morning before I go to work, I'll be easily distracted for the whole day.

too much php
A: 

I can code for 30 mins with out being distracted after which i take a small off and thn continue coding again.

A: 

I find that I can easily work without distractions if I timebox my work in 25-30 min intervals and make a point to remove distractiosn and schedule breaks between each session - see the Pomodoro Technique.

thomanil
A: 

It usually takes me at least a couple of hours before I start feeling the need to get some coffee or take a bio break. Sometimes if I'm a bit swamped, I would take a walk just to stretch my legs or get some air.

I stay away from those sites when working because if I don't, I won't be able to accomplish anything.

Also, the people who I'm working with are often too happy so I need to wear my earphones all the time to save myself from all the singing.

Mark Basmayor
A: 

I can code for too long... when I get into the zone I forget to look away from my monitor and eventually my eyes hurt enough that I loose my focus.

On the other hand every time someone walks behind my cube I loose 10 or 15 minutes of good coding. Keeping all those variables and thoughts organized so I can type good code requires concentration.

I think that the environment has a lot to do with how long I can stay in the zone, which in turn affects the quality of my code.

I started my coding career in a small consultancy in the US. We had good desks and worked in offices, never more then two guys to an office. There was little distraction and I got a lot of good work done. Other places I worked in the US were able to provide different but still quite and somewhat isolated environments that were conducive to writing good code.

Then somewhere along the way I ended up moving to Asia. And I understand why every outsourcing project I ever worked with resulted in spaghetti code. Over packed, low (to non-existent) cube walls, cheap equipment and a general morgue like atmosphere don't lend themselves to good code. I am amazed at the ability of some of the good coders I have met in Asia's ability to get into the zone at all, and I understand why everyone sees programming as a two year job before they move into <insert other position in company here>.

beggs
+1  A: 

I take as much as 10 minutes to concentrate on coding. Coffee and Trance(Club) music helps sometimes. But it can even distract as well if the environment around you is stark silent. Music helps to concentrate if the environment is noisy else it acts as distraction. Coffee is supposed to be kept as agitator during night-shifts or in the time where you get down.

Reading other programming blogs and browsing source code of other programs can help get you into rhythm if you're into developers block.

Mahesh
A: 

It appears that you are not getting in the so called zone, refer to kickstarting your day and honing your development skills for tips on how to get yourself in the zone and focus your efforts.

+1  A: 

5 mins? You know that if you interrupt your coding, you will forget about "temporary hacks", and variable names? At least 2 hours of no-distraction, is mandatory. You must become excited to code

Magnetic_dud
A: 

It's a funny thing about ADHD: I can do something called over-focusing. It lets me go three hours -- not consistently, but not uncommonly. Concerta (Ritalin) is a help for me and it seems I can over-focus just fine with Concerta.

Smandoli