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?
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.
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.
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.
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.
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 -
“Open Office” plans where you are compelled to hear your neighbors conversations.
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.
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 -
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).
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.
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.