share
Stack OverflowProgrammer’s block
[+47] [21] Kev
[2008-08-10 16:08:36]
[ discussion mental-health ]
[ http://stackoverflow.com/questions/7229] [DELETED]

Do you suffer from programmer’s block? If so, how do you kick-start your brain again? I’ve been working on a project since I returned from two weeks holiday, it’s a piece of cake to finish, but I’ve done everything except pull my finger out and finish the damn thing.

That's something which happen to me when I work too much for a project... After finishing, I take a break for 1 or 2 days... but it extends to more than that, and don't have any motivation to continue... I think the real problem is "since I returned from two weeks holiday". Anyway, +1, thanks for your post it will be useful for me ;) - Nicolas Dorier
[+33] [2008-08-10 16:27:18] eviljack [ACCEPTED]

-stay off of anything w/high fructose corn syrup

-eat a lot of raw foods (peanuts, veggies)

-no processed food

I never believed it myself but your diet has a TREMENDOUS influence on your ability to concentrate. I've also noticed that (for me anyway) I tend to code better when I am hungry and it is early in the morning.

also make sure you don't code for more than an hour without taking a break as I tend to zone out and waste hours surfing the net instead of working.


(1) eviljack, I agree from personal experience, however I couldn't avoid smiling, since the "I never believed it myself" paragraph is so totally sounding like telemarketing :) - ΤΖΩΤΖΙΟΥ
Indeed, it sounds like text from a "landing webpage" selling an ebook :) - Nicolás
What do I call to order mine today? - Gleno
1
[+32] [2008-08-10 16:30:02] winsmith

If I'm blocked, it's usually because a task seems too overwhelming to do. I recommend splitting up the task into sub-tasks. Each sub-task shouldn't take longer than an hour, in fact, less is much better. Aim for 10- or 20-minute tasks.


(2) Funny, I got it the other way around :) "This thing is so easy, that it's dead boring.." - cwap
2
[+16] [2008-08-12 17:46:49] Brian Leahy

One way out of writers block, which works for my programmer's block, is to write Something, Anything.

Junk throw away code. Just explore something. Don't worry about solving some problem, just Do. Pick something that seems halfway interesting that doesn't require too much thinking. And just fart around. Explore something you haven't before, but the emphasis here is Exploration, not learning something completely new.

Somewhere during the processes of writing useless stuff, I get some "juice" back. My brain fires up and I start thinking more creatively. I start thinking, lets see if i can do x, where x may be some feature, technique, or concept I have not ever dealt with.

Inevitably I'll end up motivated and thinking about the project I "should" be working on, and stop coding the throw away scrap once i feel refreshed.

Sometimes, though rarely, the scrap is interesting enough to come back to and review later.


3
[+10] [2008-08-22 18:53:02] dmckee

I take a walk, buy some coffee, and work a crossword. When I come back later, I try again with the programming part of my brain rested and my focus restored.

I have to take care to not check my email, read slashdot or do other technical work (don't write a solver for the crossword puzzle either, you maniac). This goes to Joel's comments on Human Task-switches [1], which describes my bad coding days perfectly.

[1] http://www.joelonsoftware.com/articles/fog0000000022.html

This works for me too - cciotti
+1 for the article link, was a really nice read. Recommended for anyone with the OP's (and my) problem! - giddy
4
[+7] [2008-08-12 17:53:35] Kevin

Exercising helps. Just a few situps/pushups until you build a sweat. Try it.


5
[+6] [2008-08-10 16:42:17] Andrew

Allocate yourself a small amount of time, say five minutes, to work on your project. I find that by the end of the allocated time I'm on course for finishing and don't want to stop.


6
[+5] [2008-08-10 16:34:14] Matt Price

Writer's block is a phenomenon when you lack the inspiration to know what to write. You sound like you know what you want/need to do. This sounds more like good old procrastination. Some times it's as easy as just doing it, other times it's not. If you are a chronic procrastinator like me you should check out The Now Habit [1].

[1] http://rads.stackoverflow.com/amzn/click/1585425524

7
[+4] [2008-08-10 17:53:49] Rytmis

Make sure you don't get stuck yak shaving [1] (briefly, doing meta-tasks, meta-meta-tasks and so on for a possibly infinite number of metas) or analysis paralysis [2]. Subdividing tasks is a good way to get past both -- just divide until you have a unit of work you can actually perform right away. At least for me, it's all about gaining momentum from small victories.

[1] http://projects.csail.mit.edu/gsb/old-archive/gsb-archive/gsb2000-02-11.html
[2] http://en.wikipedia.org/wiki/Analysis_paralysis

+1 yak shaving. That is old school. - user128807
8
[+3] [2010-03-28 10:15:26] Dave Kirby

Set yourself micro-deadlines. Get yourself a countdown timer, either a physical one like a kitchen timer, or a software one - there an numerous freeware ones out there.

Then break the work down into bite sized chunks that can be done in 10-30 minutes. Pick one and use the timer to set yourself a deadline to finish it. I usually start with a 5 minute deadline for the task breakdown. When you finish a task pick another one and work on that, until there are no tasks left.

If you complete the task in the time limit you set yourself then congratulate yourself. If the timer goes off and you have not finished then either estimate a new deadline and reset the timer, or spit the remaining work into smaller tasks. Don't beat yourself up over missing the deadline though - treat it as a game. If you think of new tasks while working towards a micro-deadline then just add it to your list and carry on.

Be sure to include frequent breaks, also using the timer - this will stop you drifting into endless web surfing. I aim for a 5 minute break for every 30 minutes of work. Also schedule occasional periods for stepping back and looking at the big picture, reviewing your progress and replanning your task list if necessary.

For a more formalised version of this technique read up on the pomodoro technique [1].

[1] http://www.pomodorotechnique.com/

9
[+2] [2010-04-27 10:44:23] Jon Hopkins

It sounds like what you're trying to do is trivial so I wouldn't worry too much about planning it out and breaking it down. Instead make a commitment to someone else around what you're trying to get done.

When I'm procrastinating I sometimes just need a bit of external pressure and the feeling that I'm going to let someone other than myself down.


10
[+2] [2010-03-28 09:13:11] community_owned

Whenever I have the block, I usually realize it's because of 'the elephant in the room' some difficult areas in my project that I know are doable but have not confronted yet; I have not really worked out the algorithms.

The way go round this is to work out the algorithms on a piece of paper in pseudo code until I get rid of all the grey areas. It helps to get away from my desk while doing this, to a café or a library or other such place.

The other solution I would suggest is to try and do a small personal project that is fundamentally different from the project that is giving you the block. The idea is to get yourself coding again.

Another trick that gets me fired up is to talk to someone about the project I am doing. They don’t have to be programmers. This usually brings back all the excitement that made me undertake the project in the first place. After a session like this I can’t wait to get back to my project and code away.

Good luck and happy coding.


11
[+2] [2008-08-10 17:56:27] Ran Biron

Coffee. If it doesn't help, a lot of coffee.

Seriously, convince yourself that there's a reward at the end of the task. If it's true, all the better. If it's not, invent something - let your imagination go wild. Range from small stuff like "when I'll finish this I'll treat myself to an ice cream" to "when I'll finish this I'll be more worthy in the eyes of my colleagues and friends". It doesn't even matter if it's a falsehood, you're not after the prize itself but after the thrill of getting there. Once you get the adrenaline flowing, it'll be a breeze (though it might be a 3am in the morning breeze - I've been there).


12
[+2] [2008-10-24 19:12:47] cciotti

When I'm really jammed up, I clean things. If I'm home I wash dishes (even the clean ones) and look out the window. If I'm at work, I clean my desk, wash a few mugs anything to put my mind somewhere else. "It" usually comes to me right about then.


13
[+2] [2008-08-10 16:58:02] akdom

All I have to say is popcorn. I keep bags of popcorn at the ready for whenever my brain tells me it doesn't want to code and I still need to. Not the buttered stuff mind you, I don't want a greasy keyboard... get the regular salted kind.

When I really need to get going, I set a cup of water/caffeine-delivery-system/what-have-you to the right of my workspace and a bowl of freshly popped popcorn to the left, and away I code!

(In case of absolute emergencies I shake some cayenne pepper and whatever spices I feel like with the popcorn before pouring it into a bowl. BEWARE: Keep a roll of paper towels or a decent napkin at the ready if you do this (unless you're the type who eats cheetos/cheezits at their keyboard).)


14
[+2] [2008-08-12 18:00:50] N8g

I Sometimes find getting a little momentum can make a big difference. Don't even think about all of the things you need to do to finish but maybe the first, smallest step that you can take in that direction. It could be as small as refactoring a single method or adding a new field to a table. when your done take the next smallest step. At some point the momentum will take over and you'll be roaring along. That's the idea anyway. Good luck


15
[+2] [2008-08-22 03:58:20] Rob Z

I have to agree with Brian [1] in that the quickest way to get rid of programmers block is to just force yourself to start writing something. However, you usually aren't going to be able to force yourself to start working on the code that managed to demotivate you into a block so the best route is to find something you are interested in and work on that for a bit.

While diet and exercise have been mentioned a couple of times, I personally haven't encountered any situations myself where that caused programmers block, excluding any after lunch slow down due to a full stomach. However, good diet and exercise does seem to help get you going in the morning when you first get into the office.

[1] http://stackoverflow.com/questions/7229/programmers-block#9071

16
[+1] [2010-03-28 08:58:28] retronym

Choose the most important unimplemented feature. Work on this, and this only, until it is completed. Make sure it is achievable in 1-3 days, if not, break it up. Ignore all other tasks until this one is done.

Write a failing test. Make it pass. Refactor. Run all tests. Commit.

Relentlessly work to reduce the time taken to cycle through this.

Do this in a pair with a colleague.

This really sharpens your focus!


17
[+1] [2008-10-06 13:01:56] Anthony Potts

It's nice to see that others get this way too. My way of facing this debilitating problem is to write down the task into smaller parts (I usually use backpack.it) and place them in order of time I think it will take. Sometimes the smallest task is something as simple as reformatting text or commenting. These are things which, frankly, I probably wouldn't get the chance to do otherwise. In the process of doing so, I get to thinking about solving an actual problem, or (in the case that I already know the solution) it starts to trivialize the solution that I have to the point where it seems silly to not be implementing it. As I inch just a little closer I find myself working a little bit harder on the next small portion.


18
[+1] [2008-10-24 18:17:38] JB King

My suggestion would be to break down what has to get done into manageable pieces and start moving. If your work seems like a huge mountain that can be a bit intimidating and so making a small hill to walk up and down may seem a bit easier to do.

If it is the bug that were working on before and still isn't fixed and you can't see a solution, then that's a different story. After the holiday you may have fresh eyes that can help though I think I'd set a limit on when to have some progress or get help or give the task to someone else to do.

I've generally had programmers block when I didn't know what to do next or when there just seemed like a ton of things to do and each time something got done, there was more to do.


19
[+1] [2008-10-24 19:07:15] Jared Updike

Along the lines of health, in addition to diet I would recommend getting up and walking somewhere---preferably not to a distracting coworker's office. I would recommend this light exercise especially during intense work periods or if you are zoning out from information overload (i.e. the web or SO). Some of my best programming ideas were born far from a computer.


20
[0] [2010-12-31 13:56:07] iTSrAVIE

The primary reason is usually the laziness, that comes to programmers. I am effected by same.

I drink lots of water, and thus have some exercise walking every one hour, out of my seat and it helps. Sitting at one place, with computer posture for long hours does no good.

Exercise and Relax your mind.


21