Matthew Ford

Search

November 7th, 4:44am 5 comments

Coder's block

Writers block is well known and documented. It's something that I experienced first hand whilst writing Beginning Merb, and it's not easy to overcome. I read on wikipedia that a neurologist reckons it's the creative parts of the brain being disturbed that causes writers block.

Coding is creative. Whilst writing code may not be as glamorous as publishing a book the two are closely related; creativity is needed to solve problems. As a coder it is safe to assume that at some point in time you might 'hit the wall' and develop coder's block.

What can be done to overcome coder's block?

If you look at some of the advice for writers block, it revolves around changing your mental state. 

  • Take a break, relax
  • Just write
  • Break it down

So how do these tips relate to coding?

Take a break, relax

This is fairly self explanatory, drop what you're doing and do something that you find relaxing for a while. Take a stroll around the block, get the blood circulating again. It might even help to have a quick nap, a soft reboot.

Just write

Get back into the flow. Pick up a side project and code on that for half an hour or so. Better yet create a branch and work on an easier feature. If you're not writing tests, now is as good a time as any, write a few tests for the code you're stuck on.

Break it down

It could be that you're just attempting to accomplish too much at once and don't know where to start. Take a step back, break the features down further until you have a chunk of code that can be implemented easily. It can help to have another pair of eyes while breaking your problem down, as they might be able to spot an other approach.

Make sure your problem is well defined, having a vague specification can lead to blocks.

Update: problem definition from alex_young

Hopefully after a while you'll be able to overcome the block and get back into it. I would be very interested to hear how others deal with coder's block, have any tips of your own?
Loading mentions Retweet
Posted 8 months ago

Comments (5)

Nov 07, 2009
Zach Inglis said...
When I was at Hashrocket we played Ping Pong to cure it.

I have friends I write letters to, so I just do that instead, or draw, or something equally creative like design a website. I relax the logic side of my brain I guess.

Nov 07, 2009
Matthew Ford said...
Interesting, at IBM we had table football - although I think they removed the table now as it was being 'over used'.
Nov 07, 2009
alex_young said...
I think this is a figment of your imagination. Programming objectives are more well-defined than when writing.

It can be hard to figure out optimal solutions, but this is simply "working hard and concentrating" rather than some kind of writer's block issue.

Nov 07, 2009
Steffen Hiller said...
One thing I do sometimes is sketching down possible solutions for a new feature or a problem on a piece of paper. Not very environment friendly, but until we don't have an Apple Tablet what else could one use? ;-)

@alex_young:
"Programming objectives are more well-defined than when writing."
What the client wants doesn't often tell you how to write or design it.
So, I definitely agree with Matt that coding is a creative task such as writing.

Moreover, blocks don't only apply to coding or writing, you can be blocked to start a task of any type.

Nov 07, 2009
Jon Wheatley said...
i guess i just change my environment when i get coders block. I find it happens when iv been spending too long on a problem. Either move from develop mode to design mode, work on a different task or change where im working. Summers great for that- either going to the park with the laptop or even better getting in my coding hammock in the garden. Winter i have to make do with moving from desk to sofa or heading to a coffee bar or going for a quick stroll to clear the head and think..

Leave a comment...

 
Got an account with one of these? Login here, or just enter your comment below.
Posterous-login    twitter