Tell me more ×
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.

Possible Duplicate:
How do you motivate yourself to program (when you'd really rather be doing something else)?

I have been at SO and Programmers for the last 2 hours just to avoid writing a bunch of unit tests I know needs to be written.

I've also read Eat That Frog! and other such stuff but to no avail. What are some of the sure fire things you do to get back to work?

HELP!

P.S: Please don't bring up willpower, I have little of it to boast of =(

share|improve this question
2  
I don't agree with the suggestions in the article but he makes a good point by saying that willpower is a muscle. You can train it like any other muscle. zenhabits.net/three-effective-ways-to-enhance-your-willpower – sebastiangeiger Mar 14 '11 at 8:34
3  
A project manager willing to give you small chunked assignments and follow up on a daily basis. – user1249 Mar 14 '11 at 10:43
show 6 more comments

marked as duplicate by Orbling, Walter, ChrisF Mar 15 '11 at 22:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

22 Answers

up vote 40 down vote accepted

First off, remove the distractions you can. For me I work from home so there's always something around to play with, but things like this help:

  • quit your browser.
  • quit Twitter.
  • quit e-mail.
  • delete (don't just quit, delete) all the games.
  • quit or hide anything else that jumps up with notifications.
  • orient the computer so you can't see that guitar, or book, or Arduino, or whatever else you might do.

Second, full-screen your IDE so it takes up your entire world.

The last thing that helps for me is to create and stick to really short deadlines. So not "I need to finish this module sometime next week", but "I need to get this method tested and working BEFORE LUNCH". It gives me some much-needed urgency.

share|improve this answer
1  
@Matthieu: as I say, I work from home. It's not so much a "work machine" as it is a "machine" ;-) – Graham Lee Mar 15 '11 at 8:57
2  
Have 2 user accounts, a work one and a personal one. Obviously your work one, you are signed out of Twitter etc. Then there is a a very clear context switch between the two situations. – James Aug 6 '12 at 8:09
show 1 more comment

Do Scrum. Even if you are one-man team. Everyday spend 5-15 minutes to visualize your progress on whiteboard. Let other people see your progress.

share|improve this answer
3  
The single man daily standup meeting is going to be really cool ;) Joking appart, that's a really good advice. I have my personal kanban. – user2567 Mar 14 '11 at 10:23
show 1 more comment

The Pomodoro Technique forces you to work on a project for a limited timespan (25 minutes) and then you have a short break (5 minutes). I found that I could delay my impulses to click the facebook bookmark or check my email for 25 minutes.

The important thing is to get started. You could trick yourself by telling yourself "I'll work on these Unit Tests for 10 minutes and then I can stop."

share|improve this answer

No book can help you if you can't help yourself. Books teach great things, but they only teach if you are ready for them. Have you ever wondered why some books sound so great to a few people? Its because they are ready for them.

The most important thing about life is we are born with only two things. Time and Energy, and both come in limited supplies. Its all about using them together. You will see as a kid you have the energy and time but you are not serious enough to use it. As a teenager you are rebellious enough and have many other things that bother you. After this, its college, job and responsibilities. By the time you get a good hold of what you are, you would have burnt through most of your time and energy.

Besides, for a healthy life you need a average of 8-9 hours sleep, 2-3 hours for natures calls and hygiene. 2-3 hours for travel. Add to this work, family time etc. Multiply that workable number of years. You will astounded to find you are hardly left with any time to get some thing great done.

You have to decide how you have to spend this little time! There has to be sense of urgency within you if see all those calculations. If you don't have that urgency and you don't feel that you have to hurry considering how little time is left, no book can help you.

share|improve this answer
1  
+1 for limited time and energy (and for 8 hours of sleep (: ) – sebastiangeiger Mar 14 '11 at 8:36

Leechblock: If you have a immediate SO/facbook/twitter addiction and you're using Firefox.

share|improve this answer
show 1 more comment

It is hard, because being distracted is EASY.

It is also very true that we all need some down-time, because thinking and being creative for 8 hours a day is just not possible. (And in many workplaces, the managers accept that their s/w people will never give more than 2 hours useful work / day - which I think indicates a management failure, but I digress).

  • Get rid of games.

  • Close you browser and keep it closed.

  • If you must have email running, turn off all the bells, new mail warnings / popups, everything that can divert your attention (AMAZING how email programs by default are like the telephone: SCREAMING at you for attention. If people must have your attention they should phone. If its email, it means YOU deal with it at YOUR convenience, which might be next week.)

  • Prioritise your tasks (more on this below).

  • Get comfortable. Make sure the light is right, the noise is turned down, you have been to the toilet... all those things that distract you when you get 10 minutes in.

  • Make a concrete decision to start.

  • Promise yourself a little downtime (ready SO) - AFTER the task is done and not before.


Priororitising is something most people I have come across don't do very well. They tend to pick the things they like, not the things that matter. Or they just start stuff for whoever is screaming loudest and never finish anything.

Here is a technique I was taught:

  • When you have something to do (a task from the boss) - ASK what the urgency is. If it must be done right now its good to know that. If it is needed in a week, then it means you can do it later and do the "must be done right now" task. [This is fundamentally about figuring out FOR THE TASKS I MUST DO, WHAT DOES THE BUSINESS WANT? Not what you want!]

  • Then, every morning, re-prioritise your existing task list. Give every task a letter:

A = Urgent, must be done B = Important, needs to be done after the A's C = better get done but it does not have to be done right now D = gee this would be nice

  • IMMEDIATELY discard all the D's. You were never going to get to them anyhow, so wipe them off the list right now.

  • Against each A, B, C task, put a number, so you have A1, A2, A3, B1, B2, C1, C2 .. C78, etc.

  • Work on the A1. When done, cross it off. Then work on A2. And so on.

  • Never start any task if a more important one is outstanding UNLESS you are blocked because you are waiting for somebody else. (eg: A3 was "Call Fred to figure out what he really wants done to fix the Defrangulator", and Fred was away from his desk. Mark it started, and move on to A4. Come back to this A3 later.

  • Move all tasks forward every day.

  • Always always reprioritise.

Yes, this takes 15 minutes every morning. Get over it.

You CAN do all this with a paper diary or use technology. Either works. Just ALWAYS have it accessible.

I have been doing this now for 20 years. It works (and I was a cynic before being taught to do this). I have had some tasks on my list for OVER 3 MONTHS before they got done - they had to be done, its just that the WHEN was not so important, so they slipped. During that busy time it was routine to have about 40 things to do on my list, every day.

share|improve this answer
show 1 more comment

Quitting Browser, Twitter and E-Mail never helps for me, because with just one click they're back again.

In the end, for me, only discipline helps. I give myself a certain time to check mail, twitter and so on, and then I just have to stop that and start being productive.

The good thing is, only the first few minutes of getting to work are hard. After that, I'm generally deep enough into my work so I don't get distracted so easily.

So if you don't have enough willpower, as you say, then there probably is no real help for you. You'll just have to learn to force yourself to start work.

share|improve this answer

There is probably a reason behind, why you "run away" from the unittest that needs to be written.

So instead of fixing the symptoms (do something you donot like) is there a way to fix the cause? can you ask your boss to have a developping task you like?

Im in the opposite situation. Some of my customers and some of my colleques think that writing unittests and do testdrivendevelopment is a waste of time and somebody has to stop me from writing unittests.

share|improve this answer

Here is a grab-bag of stuff that works for me:

1) I break down my tasks (or at least the ones near the front of the queue) into chunks of at most two estimated hours, preferably just one. That way, if I'm staring at my screen and have a meeting (or end of day) in one hour, I can say "Hey, I said I could do this in one hour, let's prove it." We use scrum, which gives me a little more motivation because those tasks and estimates are public on a board.

2) If you use emacs, org-mode is really super for keeping track of stuff. It takes a while to learn, but it has saved my life at work. One particular thing it is good for is allowing me to shelve a distraction (say, an email I know I need to respond to) and know that I'll see it and come back to it later.

3) I have a little emacs function that I have bound to a key, which prompts me for a single line description of what I have just done, and appends it with a timestamp to the end of a given "diary" file. The descriptions can be as simple as this (a real sample):

08:12 Setup
08:16 Ready to look at #28614
08:24 Syncing
08:31 Compiling
08:45 Complete
08:48 Verified issue
08:50 AutoOn is false
08:57 Attemped fix
09:00 Checking
09:03 Confirmed

If I glance back at my diary file and see that there are big empty gaps in it, it's embarrassing, so it's a good motivation to keep working.

Here is my emacs function, if anyone is interested:

(defvar timestamped-note-file "c:/doc/diary.txt"
  "File to store timestamped notes in.")

(defun register-timestamped-note (text)
  (interactive "sNote: ")
  (save-window-excursion
    (find-file timestamped-note-file)
    (save-excursion
      (goto-char (point-max))
      (insert (concat (substring (current-time-string) 11 16) " " text "\n")))))
share|improve this answer

I find a good old fashion to-do list helps a lot for me.

For your unit tests be sure to break it down in to small prices so that you can continually mark something as completed. go ahead and put things you have already done on there and mark them off.

I find making the list to be easy and something I don't mind then once it is complete and some things are already marked off and I have a nice small thing to focus on it is much easier to avoid distractions.

share|improve this answer

Deadlines.

Break the work down into small deliverables. Estimate how long it will take you to do those tasks.

Try to accomplish those tasks within a given deadlines.

share|improve this answer

Here's what I usually do:

  • Define long term goals you want to achieve (should be doable but still challenging), as well as deadlines.
  • Define short term goals for each long term goal. Don't forget to put deadlines here as well!
  • Assign priorities for each task (e.g. A, B, C, D). Try to finish the tasks that give the most bang for the buck first.
  • Start working!
  • Feedback loops every 2-3 weeks to make sure you are on-track.

I'm not saying this helps all the time, but at least it makes me procrastinate less.

share|improve this answer

Music is not always the answer. Studies have shown that students who listen to music while solving problems still solve the problem, but they are less creative about the solution. It has something to do with the side of the brain you use for creativity. If you're listening to music, that stimulates that side of your brain, reducing your creative abilities. I wish I could cite that aricle, but I can't seem to find it. And programmers.stackexchange.com is acting as a distraction in itself right now, so I don't have time to look through my browser history - gotta get coding!

Now, if you're copy-pasting a code snippet into 1000 files and it doesn't take much thought, music is nice. It can keep you focused and happy while you do those mundane, make-you-want-to-kill-yourself tasks. But when you're actually coming up with software engineering solutions (real programming), don't listen to music.

Instead, listen to white noise: http://www.simplynoise.com/

I work in an open office with a tall ceiling which has a lot of noise - people making phone calls, and people making random comments on the height of the river or the cats outside the window, or the rain, or the OSU basketball game over the weekend - whatever. Stuff I really don't need to know, and will just slow down my development by distracting me. I put my headphones on and listen to white noise. It prevents people from bothering me as much (they don't ask me again what the date format string is, cuz they'd have to get up and tap me on the shoulder - they actually Google it), and it blocks out a lot of noise, while leaving my creativity un-hindered.

share|improve this answer

@ammoq Listening to music while working is an unseen distraction.

share|improve this answer

The pomodoro technique is a useful antiprocrastination tool. I was suffering with the same problem as you when i wrote this: http://johnnosnose.blogspot.com/2009/06/pomodoro-technique-first-impressions.html

share|improve this answer

For me, popping in the earplugs and listening to music usually helps. Hmm... I should give it a try right now ;-)

share|improve this answer
show 2 more comments

Your supervisor gave you too much time to complete the task or you are in the habit of turning in work that is poor quality. Waiting until the last minute seems to be working for you.

Eventually you either build up higher-standards for yourself that are beyond everyone else's or you're just going to be allowed to waste time.

Personally, time spent on SO has raised my expectations out of my code. I've been exposed to what I didn't know I didn't know. Users and supervisors will let you get away with crap. It works, so it must be good. You make a change and it introduces a bug, so what, they've grown to expect that from you.

share|improve this answer

A insight that might help: Being in the middle of doing the work is usually less painful than being in the middle of procrastinating. (http://lesswrong.com/lw/3kv/working_hurts_less_than_procrastinating_we_fear/)

share|improve this answer

Another effective technique, when possible, is to get a very fast machine (or enough RAM/SSD) to ensure that few actions would take more than a few seconds (e.g., running tests, rebuilding, etc.)

In my experience, much procrastination starts in those devilish "30 second" waits that are so common (e.g., Eclipse rebuilds). Once you switch elsewhere, you're not going to be back so soon.

share|improve this answer

I keep it old-school, with pen and a paper notebook. I itemize my immediate tasks down to very trivial, non-threatening bits. Each of them normally fits in one line. No deadlines, just a list of activities you can chose from.

Then as I go through my day, I strike out the completed lines. Feels very satisfying.

share|improve this answer

I recently came across the phrase "Motivation follows action" in some self-help type book. And it's absolutely true. If you can just get started on the project... well if it's at all worthy of any attention you will become deeply immersed in it and before long it'll be hard to tear yourself away. The thing is, once you're aware of this (repeat the mantra: "Motivation follows action, motivation follows action...") it does actually become easier to start these things.

share|improve this answer

I wait until the deadline is just a little bit sooner than the amount of time it will take to complete the task.

Works every time.

share|improve this answer

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