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.

Sometimes, the things I have to do for my job are interesting and engaging. Sometimes, they aren't. Occasionally, they really aren't.

Do you have any particular strategies or tricks for dealing with those dull stretches when your brain would rather be doing anything other than what you're supposed to be doing, particularly when the Internet and its boundless opportunities for interesting Slack beckon?

share

locked by maple_shaft Jul 28 '13 at 12:39

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.

closed as off topic by Walter, Thomas Owens Nov 13 '12 at 19:09

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

7  
You can start by not posting questions/checking questions on Programmers/StackOverflow :) –  Victor Hurdugaci Sep 16 '10 at 12:11
comments disabled on deleted / locked posts

24 Answers

One of the best ways I've found to stay focused is to give myself a reward at the end, so that I have something to work towards...

This is a prime example of why the Stack Overflow model works so well, because we want to be rewarded for our efforts!

For example:

  • If you like working out, go for a run afterwards.
  • If you are reading a good book, don't read it over lunch break; save it for after work.
  • If you have a favorite TV show, put that on after work.

There are lots of ways to self-reward. Some are healthy, some are not; be careful which ones you choose. Everyone is different.

share
add comment

Unplug the network cable.

share
add comment

Embrace the distraction for 5 minutes. I find that if I try to ignore a distraction, it'll bother me for longer than if I just got it over with.

5 minutes isn't a lot of time to lose, and once it's over I feel that I don't need to think about whatever it was and I can work again.

share
add comment

StayFocused - a Chrome plugin LeachBlock - a Firefox plugin

share
show 1 more comment

If you have a laptop and a spare meeting room, locking yourself away can help. People don't know where to find you, your desk toys are out of arm's reach and being in a different environment reinforces the idea that you're there for a reason. It's not a long-term solution, but helpful when you need to cram.

share
add comment

I listen to music mostly. When I need to be really focused I find this white-noise inspired pandora station to be particularly effective: Ovals.

share
add comment

Forbidding myself from going to StackOverflow, Programmers.StackExchange, or any other site like them (except for strictly research reasons... hrrm maybe this might not work afterall)

share
add comment

Leechblock. And headphones with electronica / dance music (no words).

share
add comment

Headphones with music. Or sometimes just headphones on will deter anyone from bothering me-- no music necessary!

Other times, I just turn off Outlook, Gmail, cellphone, and any other live feed of social media. Basically I'm controlling when I'll check these kinds of feeds to a few times per day rather than every few minutes.

share
6  
+1 for headphones with no music. It does wonders. –  Anna Lear Sep 16 '10 at 12:59
add comment

If I really need to be focused, I work from home. No noise (unless I'm playing some music). No one dropping by your cube to say hi.

share
add comment

I like to use Rescuetime. RescueTime gives you a note between -2 and 2 to yours productivity. For me it is a challenge to have a note next to 2.

share
show 1 more comment

Often times the nature of the cubicle farm itself can lead to this issue. Try to avoid these conditions if you have control over your office environs -

  1. “Open Office” plans where you are compelled to hear your neighbors conversations.

  2. Having one phone for several people in your area so you cant disconnect it and have to attend it on the off chance it yours.

  3. Conversations over information that can be sent by email or IM or SMS or any of the multitude of asynchronous forms of communication available today.

If you don't have control over the office environs, here some things you can do -

  1. Some people wear head-phones to block the ambient noise and subtly indicate to people they are working on something and interruptions are not encouraged (YMMV – I have seen people ignore the subtle indication and come over anyway).

  2. Some people deal with all their email and IM at scheduled intervals – this way everyone gets their reply and people learn to come with the questions at those times.

It is necessary to keep a balance being too focused for long periods of time can lead to burn-out. Check out this blog post for some more info.

share
add comment

Some things I do:

  • Leave less windows open
  • Organise my desktop (using fences http://www.stardock.com/products/fences/ )
  • Try to do 1 thing at a time, multi tasking always ends in tears
  • Shut off the world (email, web, phone) for dedicated blocks when trying to get something important done
  • Keep my email inbox empty
share
add comment

I know Test Driven Development (TDD) isn't to everyone's taste, but one of the reasons I like to practice TDD is to help me get over the "humps" in the day.

If I find myself getting distracted, I can add a failing unit test that tests some tiny thing and get going again, or I can crack open code and take a look at refactoring it, or renaming some variable or function. Once I get started on that, I can typically be productive again.

Using TDD means that I have lots of "mini" goals in the day, which help me get to the bigger goals.

share
add comment

I find that getting up from my desk for a short walk (2-4 minutes every hour or so) clears my mind and lets me get back in the groove. Note that this needs to be scheduled and disciplined, otherwise it becomes mere avoidance and anything boring or difficult will result in me wandering aimlessly for a bit and not getting anything done.

share
2  
Having a smoke is like short walks on steroids. Nothing super charges mental stimulation like nicotine when you're stuck on a problem. It gives you a timer too because 1 cig ~= 5 minutes so there's no excuse not to go right back to work afterward. Too bad it's terrible for your health. –  Evan Plaice Sep 11 '10 at 11:19
add comment

Try to get into "flow state". It can often be hard, so you should reduce distractions as much as possible. If you are tired, do some exercise - it will wake you up.

share
add comment

Avoid web browsing non-work related sites (whoops, better go now!)

share
add comment

I have found the pomodoro technique useful for increasing my concentration at work, specially for things I don't really like doing.

share
add comment

Increments. I will pick something that I can do, even if it's a small task (i.e. modify comments in code). Pretty soon, the perfectionist in me wants to do more and more stuff and I'm back rolling.

share
add comment

Hmm, I'm only able to focus if I'm really interested in what I'm doing. For boring activities I use a "hopping" method, jumping frequently from the actual work to something different (even web browsing), and so I maintain a reasonable productivity.

By the way, a basic thing to understand (especially for employers!) is that you can't be focused indefinitely. Our brain will reach a climax of concentration after some time, will keep it for some time (it's that time when you have that full comprehensive vision of your work!) but then it will drop quickly. This attention pattern may vary a lot on individual basis, but a cycle usually lasts 45 minutes.

share
2  
Sometimes it's the technique I use, but also when I'm too deep into my work and I want to change my mind to get a "fresh" look to my work. –  Gabriel Mongeon Sep 1 '10 at 19:51
3  
ah, is it called hopping? Now i know what i really do at work. hop hop hop .. –  systempuntoout Sep 1 '10 at 21:41
show 2 more comments

One word: Workspaces

I develop in Firefox but browse, etc in Chrome. And since I use Ubuntu I have Pandora, email, Stackoverflow etc open in one workspace while I have my editor, dev browser and mysql client gui open in another.

By keeping the two workspaces separate I tend to be able to focus more on actual programming and I don't distracted by having all of those shiny tabs to click on to check the latest status of my StackExchange sites, etc.

share
show 2 more comments

I work from home, so focus is a constant struggle.

Music, caffeine, and good eating habits go a long way.

If I still can't focus after that then I probably wasn't meant to be focusing right then and I go do something else for a bit and come back.

Having multiple projects/pieces of work to do makes a big difference too. If one gets boring, switching to another for a few hours is often a good quick fix.

share
add comment
  • If you really cannot avoid distraction, then learn something
  • Ask a colleague whether they need a hand - it'll repay itself later
  • Turn on some music
  • Work on a different part of the same project
share
show 1 more comment

Stress. I give in to temptation and surf StackExchange/Reddit until the last possible minute, then bang out what needs to get done. Nothing like a 1 hour deadline to keep you focused.

share
17  
+1 for truth, -1 for practicality. :) –  Tobiasopdenbrouw Sep 1 '10 at 19:49
add comment

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