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?

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

Questions on Software Engineering Stack Exchange are expected to relate to software engineering 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.

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.

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

24 Answers 24

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.

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.

  • This is probably one of the easiest (if your on Linux) things that you can do to instantly keep yourself productive. That is until you figure out how easy it is to do Ctrl+Alt+Left (or whatever combination you use) – TheLQ Sep 1 '10 at 21:23
  • +1 amen. I usually have chrome in the first, Monodevelop in the second, git stuff in the third, and nunit in the fourth. Also, I change the keyboard shortcuts to super+left/right to switch workspaces, super+up to initiate the window picker, and super+down to unfold the compiz cube. – Evan Plaice Sep 11 '10 at 11:11

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.

  • 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
  • @systempuntoout: I call it that way because it resembles to me the frequency hopping method! – Wizard79 Sep 1 '10 at 21:44
  • Hmmm. I'm the opposite. After about 20-30 minutes I break into 'the zone' and can code intensely for anywhere from 7-14 hours straight with short breaks for food/cigarette/coffee if I'm struggling with a certain issue. I have actually gone as long as 20 hours straight before without more than short pauses. Obviously, I don't work a standard 9-5. – Evan Plaice Sep 11 '10 at 11:14

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

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.

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

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.

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.

  • 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
  • I like the last one, working on a different part. It helps me not just for focus but also for some procrastination when the code is big and complicated – TheLQ Sep 1 '10 at 21:21

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)

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.

  • 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

Some things I do:

  • Leave less windows open
  • Organise my desktop (using 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

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.

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

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.

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.

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.

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.

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.

StayFocused - a Chrome plugin LeachBlock - a Firefox plugin

  • +1 for StayFocused. I would have given you +1000 if I could. – IsmailS Nov 18 '10 at 8:59

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

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.

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.

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.

Unplug the network cable.

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