DEV Community

Cover image for Understanding And Overcoming Coder's Block
Lorenzo Pasqualis
Lorenzo Pasqualis

Posted on • Updated on • Originally published at

Understanding And Overcoming Coder's Block

This post was first published on CoderHood as Understanding And Overcoming Coder’s Block. CoderHood is a blog dedicated to the human dimension of software engineering.

What is Coder's Block?

Coder's block is a period during which a developer struggles to write good code or any code at all. During a block, ideas don't materialize, and the overall goal of a project seems far and out of reach.

Writing code is a creative pursuit that requires using a combination of both the left and the right brain. All such activities sometimes run into a block that can be described as a lack of creative energy; this is a well-known issue with writing (it's called writer's block), but it affects coding just as much.

In my experience, coder's block is caused mainly by one of five root causes. I am going to examine each one of them, giving you strategies to recognize and overcome it.

Cause #1: You are not 100% clear what is the goal that you are trying to achieve

Coding is a creative activity, but it must be focused toward the accomplishment of a goal or the resolution of a problem. When the target or the problem is not clear, it is difficult to get started.

To recognize if this is the problem you are experiencing, think about what you are trying to achieve. In particular, can you answer two fundamental questions?

Two fundamental questions

  1. What goal are you trying to achieve?
  2. Why are you trying to achieve it?

Sometimes you might be tempted to answer "I am trying to get my project done" or "My goal is to keep my job," but that's not the type of goal I am referring to. Take yourself out of the picture. What you need to think about is the project itself. What is the purpose? Why is the project vital if you take yourself out of the equation?

If you can't answer the questions, try the following:

Turn off your computer

Do not even try to start writing code until you understand the goal that you are trying to achieve. Close your code editor and turn off your computer. It is a distraction, and it won't help. Instead, grab paper and pen and start thinking about the goal. Don't worry about how to achieve it, for now, just concentrate on what you are trying to do and why it needs to be done. Don't worry about the "how" yet.

The freedom of pen and paper

Pen and paper give you a freeform way of thinking and taking notes; it releases you from the annoying constraints and limitations of software tools. Avoid staring at the white page; instead, write down everything you know about the problem. Describe the goal, and why you should try to achieve it.

Draw pictures if you want to, and take notes on anything that comes to mind. The act of jotting things down will get your creative juices flowing. Pen and paper stimulate both the left and the right brain, priming the creative process.

Get up and talk to someone

When you have done some thinking with pen and paper, get up and talk to somebody. Ideally, the person you speak to is someone familiar with the project, but it is not necessary. You could use a friend or a family member, explaining that you need to describe something you are trying to do and that you'd like to get their thoughts. The simple act of expressing something to someone is often enough to get your brain moving in the right direction.

If you don't have someone to talk to, explain the problem to your pet or a stuffed animal. It doesn't matter who you are talking to, or if they understand you. The important thing is that you describe your goal out-loud. Keep talking about it until it is more evident in your head.

Rinse and repeat

Go back to pen and paper, and think about the goal some more. Review your notes, and see if you can answer the two fundamental questions mentioned above. If you can't, talk to someone again. Repeat the process until you feel that you can describe confidently what the goal is and why you need to achieve it.

The time invested in thinking about the goal might seem like a waste of time, and it won't feel like making progress toward a solution. However, let that thought go; it is a fallacy. You can't write code to implement "how" if the "what" and "why" is unclear.

Cause #2: You keep changing your mind on how to approach the problem

If the "what" and "why" are clear, you might be stuck on the "how" because you keep on finding reasons why your solutions are not good enough; this is a common problem that I call "the self-doubt loop."

The self-doubt loop

It occurs when you see issues with every solution that come to mind, and you can't settle for anything. As a result, you think in circles and make no progress.

It gets particularly bad when you start implementing a solution, and you find problems with it and change direction only to see more problems. You keep changing path until you get back to the first solution, and the cycle starts again. It feels like madness.

Take a break

The best way to break that loop is to stop thinking about the problem for a little while. Get up, go for a walk, talk to someone, eat something, have a cup of coffee, do something else or sleep on it overnight. After a break, get back to the problem, list all the possible solutions that come to mind, list pros and cons for each and see if you can settle on one.

Look at the goal from different angles

If you get stuck in the vicious loop again, go back to thinking about the purpose and make sure you understand it. Try to look at it from different angles. Try to re-define it and re-examine it. Ask yourself how you'd resolve the problem if you had to do it by hand and see if that helps. Think about it in practical terms, and with concrete examples to prevent over-abstraction or over-engineering.

Do not let perfect be the enemy of good

It is entirely possible that a problem doesn't have a perfect solution. Choosing a path, even an imperfect one, is often matter of making a decision and sticking with it and dealing with problems as they surface.

Do not let "perfect" be the enemy of "good." Perfection does not exist, and most solutions are a compromise. That is normal and expected.

Cause #3: The amount of work in front of you seems daunting, and you don't know where to start

When you look at a project in its entirety, you might feel like the end is not in sight. Getting stuck on the enormity of the goal is a typical cause of coder's block.

Split a large goal in sub-goals

Overcome this issue by putting the five fundamental problem-solving skills of software developers into action. Start by breaking down the overall goal into small sub-goals. Write them down in the order they come to mind. Once you have a list, make sure that they are well defined.

When you have a list, sort the sub-goals in the order you think you need to accomplish them. If any of them is too large, split it into smaller ones.

Work on the first sub-goal

Once your problem is split into multiple smaller parts, tackle the first one and finish it. Focus on it entirely, without getting distracted by the overall goal.

Remember to think parallel, abstract but avoid over-abstracting, consider re-using existing solutions and think in terms of data flows.

Calibrate and do more sub-goal splitting, if necessary

Concentrating on one sub-goal at the time will get the coding process moving, and you won't feel so overwhelmed. Use the time spent achieving the first sub-goal as a measuring stick to calibrate how large the other sub-goals are.

Each sub-goals should be no more than one week worth of work; if any of them takes longer, you might want to split them into smaller ones. Avoid large sub-goals as they tend to cause coder's block for the same reasons that large goals do.

Cause #4: You are not excited about the purpose

We discussed how knowing what you need to implement and why you are doing it is essential to make progress. However, even if you have the answers to those questions, you might not be convinced that the project is worth your time. That could be due to tedious work, or because the goal is to solve a problem that you don't find attractive or essential. Lack of excitement for a project is one of the most common causes of coder's block.

What can you do about it?

Use the project to learn something new

Maybe the project is not fun or exciting, but perhaps there are ways to transform it into a learning opportunity. For example, you could choose to use some new library or framework that you haven't used before. Or you could try to apply techniques or design patterns that you want to learn. There are countless ways to build the same piece of software, and learn something new can make even a dull project exciting.

Find reasons why your work is essential for the customer

Sometimes better understanding the needs of the customer can make a dull project more interesting. Take an opportunity to talk to some of the customers that are interested in the work you are doing, and find why it is important to them. If you don't have an opportunity to talk to customers, talk to customer-facing people in your organization, and find out why your work is essential.

Take the opportunity to tackle technical debt as part of the project

Are there ways to tackle some of the technical debt as part of the work to get the project done? If the job you need to do requires integration with an existing system, perhaps you can use it as an opportunity to fix some old issue that has been looming for a long time. Find ways to inject some work you want to do in the mix of work you have to do.

Cause #5: Something in your life or the work environment is bothering you, and you can't concentrate on your work

Creative work requires focus; distracting thoughts could be the cause of your coder's block. Is something bothering you? Do you have personal problems that are interfering with your concentration? Or perhaps the work environment is creating unhealthy stress levels that are getting in your way?

There are several things you can do to overcome this kind of coder's block:

Make a list of the things that are bothering you

Sometimes you can't focus because you are concerned that you'll forget about something important you need to do. Make a list of whatever is on your mind, with the intent of getting back to it at a better time. The act of writing down your distractors is sometimes enough to get you out of a coder's block situation.

Resolve the issues that are getting in your way

In some cases, you might need to take a break and prioritize fixing the issues that are bothering you. If the problems are personal, take a few days off to deal with it. Resolving something that is weighing on you, if possible, might be the best solution for your coder's block.

If the issues are work-related, take some time to deal with them. Talk to your boss, your coworkers, Human Resources, or whoever might be able to help you. Letting problems linger makes it difficult to break a coder's block.

Seek help

If you cannot resolve quickly the issues that are bothering you, seek help. Letting worries or anxiety linger is exhausting and terrible for your productivity and health. It is best not to let it go for too long. There is nothing wrong with seeking professional help or help from friends and family.


Coder's block is a nuisance that you can overcome. It is similar to being stuck in the mud with your car. The natural instinct of stepping on the accelerator is going to make it worse. You need to be smarter than that.

The first step is to realize that you are experiencing coder's block. The second is to try to understand the cause. The third is to choose the best strategy to overcome it.

If you enjoyed this article, keep in touch!

Top comments (11)

kwabenberko profile image
Kwabena Bio Berko

Great post. Very helpful. The second point you talked about happens to me a lot. Doing something else and staying away from the computer for some few minutes usually gives me a whole new perspective of the problem I was trying to solve.

lpasqualis profile image
Lorenzo Pasqualis

Thank you! Very glad that this was helpful.

coolgoose profile image
Alexandru Bucur

I think the problem is that coding in general is a creative process and good developers are perfectionists. Maybe we should draw inspiration from how artists handle blocks be it painters, musicians or anything else

marcuzy profile image
Oleg Krasavin

I used to get stuck on some tasks very often and didn't know what to do with that within fairly long time. By now I found some ways of overcoming such states and your article give me some new useful tips. Thanks!

s_anastasov profile image
Stojan Anastasov

I have experienced #1 and #4 on a smaller scale. Not really as a block from writing code but more as an excuse for procrastinating and spending more time slacking than coding.

Great article, thanks for the tips for fixing the problem.

hydrogen2oxygen profile image

Hi Lorenzo,

you're right, our ability to write code depends on "right and left brain activity" / creative energy. I learned a lot from TCM (Traditional Chinese Medicine) regarding the cause of such "blockage". It depends most time on a problem with the "liver energy". Our sedentary way of life is problem number one. This cause in us a blockage of liver energy and the creative energy depends on that on a long term.

One solution: move!

Sport or taking a walk helps a lot.

Another possible cause: We may think, without being conscious of it, that the entire project makes no sense. If this is true or not, our subconscious part will not release creative energy in an abundant manner.

hawicaesar profile image

Love this. Lorenzo you are very resourceful!

lpasqualis profile image
Lorenzo Pasqualis

Thank you! :)

mccurcio profile image
Matt Curcio

The info in this article is great and so much common sense.

As I read it (I don't know how many times I said to myself)

I knew that, hmmmm, but how often do I stick with it?


helderberto profile image
Helder Berto

Amazing post! 👏

alex_escalante profile image
Alex Escalante

I have faced real blocks when writing fiction, poetry, or music (I am an artist and a software engineer), but never when programming!