Is it possible for a programmer to suffer the equivalent of writer's block? What strategies are there to overcome it?
Yes programmers can get blocked, but not in the same way as writers. We get blocked because we're too close to a problem, or too far away. We just can't get the gray matter to pick a good path in the N dimensional maze that is programming. A break, a chat, especially describing the issue to a co-worker can work wonders. Note describing a problem will often cause your brain to see a potential solution, you need to chat to a willing sounding board but they don't necessarily have to be technical or know what you're talking about.
Writers' block is similar in nature but effectively a different beast. It occurs not because the author can't solve a problem but because the author can't get their mojo going, their inspiration is lacking, their muse is on holiday, the internal voices are simply telling them it's all rubbish, not even worth writing down. In addition it can last for days, months, years. The act of writing code and writing prose are superficially the same but they come from different parts of our spirit.
Funny you ask. I was just talking with one of my engineers today about programmer's block.
I recommend programmers have 2 or 3 active tasks going at a time that he/she can work on. When you get stuck somewhere, it's nice to be able to switch gears and work on something else for awhile and then come back to the problem with a fresh perspective.
I find that when I come back to the problem, I oftentimes come up with a solution/plan that I might not have otherwise come up with. Sometimes when working on one task, I run into something there that actually triggers the light bulb in my head for the problem that I was struggling with.
One of the other engineers I work with says he'll take a 10 minute break and go take a walk. He says that when he comes back to his desk, the answers suddenly start pouring back in.
I find it helpful to talk through the problem with someone else, even if that someone else isn't a programmer. I can't count the number of times I've been just talking about a problem when suddenly the answer comes to me.
In short, I think the best advice is that if you're stuck, switch gears for a bit.
As someone who's been an amateur freelance writer (of sorts) and gone through writer's block before, here are my thoughts:
I essentially agree with MrTelly. But just to make it loud and clear: programmers block and writers block are different beasts because they actually come from different causes. Programmer's block is, in most cases, a technical issue of being too close to a problem and "not seeing the forest for the trees", and convincing yourself that you're on the right track. ie Not stepping back far enough to consider an alternative solution.
Writer's block, on the other hand, is almost always a case of lack of inspiration. After writing, say, 50 pages on a given subject, you just feel like you've exhausted it, and like anything else you have to say will just be padding and/or rehashing the same subject matter in slightly different ways. But you still have a contract (figurative/internal or actual) to write another 50 pages, and you just don't know where this is going to come from, because your brain and soul are simply spent on dealing with the subject at hand.
All that said, early stage burnout can also feel like you have programmer's block. This is a whole other animal though, and has subtly different symptoms. But I thought it's worth a mention, because feeling like you have programmer's block is one of the early warning signs of burnout - most often accompanied by apathy (ie No longer truly caring about solving the problem, and just wishing it would all go away. And feeling like the job/project itself is totally pointless.)
I guess they are similar in you can't get your work done, but as a programmer, it's easier to go to colleagues or the Net and look for solutions and/or get help. Not sure a writer has this luxury. If you're in a funk, and know what to do but just can't get yourself to crank out code, it may be more of a sign of burn-out.
For me is usually bacuse, I've just had one too many nasty bugs to chase down, and I'm worried about making more blunders. Then, if I have avoided finishing a particular piece of code for a while, I end up with a great deal of anxiety about picking it back up. And the funny thing, is that that anxiety is there even if my break from finishing it had nothing to do with the difficulty of the task (often I had a higher priority task to do first). This is about more than the cost of the mantal context switch. I think it has to do with fear of making a mess of things. I think that fear may be warranted, because as programmers we are smart people interested in efficiently doing a task -and that means we take mental shortcuts. And most bugs are found to be caused by mental shortcuts. And the cost of finding a fixing them is orders of magnitude greater then the effort saved by the shortcut.