We’ve all been there.

Sitting at a desk, staring at a computer display, watching the cursor blink in Xcode. Time feeling like it has come to a standstill. The dreaded mental block.

No matter how long we have been developing software, inevitably we all have a mental block from time to time. Sometimes we get past the block easily, but other times we may have to apply specific techniques to help us conquer it.

What is a Mental Block?

A mental block can manifest itself in various ways. Sometimes it’s an inability to think clearly about a task. At other times, it could be an overwhelming sense of anxiety or stress about being unable to solve or get past a problem. This creates a virtual wall that our brains just can’t seem to work around.

Mental blocks can be very frustrating and demotivating, especially if you know that someone else is relying on you to come up with a solution to the problem. As software developers, we solve problems every day, so the occasional mental block just comes with the territory. At times, they can feel almost impossible to get past — but get past them we must, one way or another.

Ways to Remove Mental Blocks

Because having a mental block while developing software is a fairly common experience, I thought it would be helpful to share a few of the techniques that I use to deal with them. I also asked the development team here at MartianCraft for their tried and true methods. Here are our tips.

Break it Up

This may seem obvious, but larger tasks can be much more daunting than smaller ones. One way to get around a large mental block is by breaking it up into smaller pieces.

Smaller problems are generally easier to complete than larger ones, so after you’ve broken up the big task into small ones, take them one at a time. Also, reward yourself in some way after you finish each task: Take a break, go for a walk, grab a cup of coffee — whatever you personally will view as a reward for finishing that task.

Once you’ve rewarded yourself for one task, proceed to the next, and repeat the process. Eventually the larger super-task will be done, and along the way you will have earned some nice rewards. When it’s all done, you can even give yourself a big reward. You’ve earned it!

A Picture is Worth a Thousand Words

Another method I like to use is to sketch out the problem on paper. I tend to be more of a visual thinker and problem solver than a text-based solver. If my flow is broken by a complicated problem that is difficult to unravel, grabbing a clipboard and a piece of paper and sketching the problem out as a flow chart, diagram, or just a bunch of random shapes and words often makes the problem much simpler to resolve. It’s almost as if the solution emerges from the drawing.

Diversionary Tactics

A third technique that I like to employ is to divert my attention to something else. Sometimes the solution to one problem is to work on a different one, letting your brain absorb and complete the new task.

For example, sometimes I will pause working on a particular coding task and switch over to performing a code review, giving my brain a different set of problems to think about. The context switch required to focus on a new problem allows a kind of decompression to take place with the original problem.

When I return to the original task, it feels more fresh. It’s as if a background task has been running in my brain the whole time and has been able to work through some of the details without my being consciously aware of it.

Sleep on It

I have been a fan of power napping for the last five years, ever since a coworker suggested that I try it and develop the skill. With practice, you can train yourself to fall asleep almost immediately and wake up 10-15 minutes later (to make sure, you can use a timer).

This technique is not for everyone, but if you can develop the skill, it can be particularly effective for overcoming blocks because it removes you physically and mentally from the problem — at least consciously. Subconsciously, your brain is still working the problem through.

I’ve had many times where a problem was blocking me and I was able to walk away from it for 15 minutes, take a power nap, and come back to find the solution much clearer. As an added bonus, I also feel remarkably refreshed after a brief rest, and a 15-minute nap generally does not disrupt sleep at night.

Other Techniques from the MartianCraft Team

When I asked the team at MartianCraft what techniques they like to use to overcome mental blocks, the results were very interesting. One method was recommended in some form by everyone who responded. And some of the other suggestions that came in were truly unique and creative.

Get Away from It All

In every response that I received, the technique of physically getting away from the problem was recommended — but each team member had a slightly different take on it.

Julia Richert (@juliainor)

My personal best tip is going for a walk. Not unique, I know, but it works for me and there’s research behind it being a good way to get thinking done. No podcasts, audiobooks, or even music. Just walking and paying attention to the world around me.

Richard Turton (@richturton)

Get away from the desk, either for a run, a walk, to make lunch, or something else. For me, I frequently have a-ha moments halfway through a run.

Eric Welander (@ericwelander)

A change of scenery can really help my thought process. I frequently visit my local library or coffee shop when I’m trying to think through a hard problem or get creative ideas.

Cory Bohon (@coryb)

Whenever I get into a state where I’m bashing my head against some code to no avail, or I just feel frustrated with where I’m at on a project and the ideas just aren’t coming, I like to go out and take a walk. Not to take my mind off the task at hand, but rather figure out ways around it.

While I walk, I usually listen to music or try to explain what I’m doing to myself (just like “rubber ducking” with someone). Sometimes the answer comes to mind, and sometimes it doesn’t — but when it does, it’s magical and gives you that “I’ve got this” feeling.

Kyle Richter (@kylerichter)

Mental blocks are frustrating, and our natural reaction is to double down and try to push through. While many others have already talked about getting out and going for a walk or changing location, my personal secret is just to change the subject. Yes, going for a walk or sitting in a tub accomplishes this, but you can also shift to another subject and stay productive, too.

Our minds seem to have two problem-solving tracks. One is for direct attention, where we focus on a problem and try to force a solution through. The other is more like peripheral vision — don’t even think about the problem, and sometimes an answer jumps into your head. Whether you get there by going to sleep, working out, going for a walk, playing with your dog, or changing your environment, take some time and don’t think about the problem at hand, and you might be surprised that the solution just slips in.

Talk to a Duck — or a Human

Cory Bohon’s answer above mentions “rubber ducking.” The technique of talking a problem out — sometimes called “rubber ducking” or “rubber duck debugging” — was also suggested by several team members. Talking over a problem with another person (or a rubber duck) can often help you see how to resolve an issue.

Julia Richert (@juliainor)

Talking to a trusted colleague can be super helpful. We’ve all been there at various times, so they can empathize. And they probably have a better perspective on how we’re doing than we do!

Cory Bohon (@coryb)

If the idea or task at hand still isn’t coming to mind, then I usually reach out to a team member and go the traditional rubber ducking route of explaining the task and bouncing ideas around until we come up with a solution that will work.

Richard Turton (@richturton)

Write out a message or Stack Overflow question explaining your problem. The mental shift involved in framing the issue for outside observers often gives you a new insight. This works better for me than rubber ducking, because I don’t own a rubber duck and it also doesn’t make my wife think I’m going loopy.

Kyle Richter (@kylerichter)

Ahh yes, the rubber duck approach — a favorite of the cranky old software developer. The secret, in my opinion, to the rubber duck is that it forces you to explain through your assumptions. Often we get stuck on the complex part of the problem, not understanding that the issue lies with a mistaken easier assumption. Being forced to explain the process from the beginning forces us to say our assumptions out loud.

If you watch someone fix a problem by rubber ducking, it’s almost always before they actually get to the main problem — they have that “eureka” moment when talking about the background.

Unit Tests and Extracting the Problem

Software developers often have a very specific set of problems to deal with, and most of the time those problems manifest themselves in code. One technique that can be very useful in dealing with these kinds of problems is creating unit tests to help break them down and exercise the larger problem in smaller parts. Another method is to extract it and simplify it so that it can be moved or even tested in a separate software tool or testing environment.

Richard Turton (@richturton)

For code problems, I try to focus what I’m working on just to the specifics of the problem. Exercise the code by adding unit tests instead of running the app, create a throwaway SwiftUI project and work in that, or pull the relevant parts out into CodeRunner — anything that reduces friction and cycle time.

Create Your Own

Mental blocks can be aggravating, especially when they prevent us from making progress on important problems and tasks. We at MartianCraft hope that the suggestions we shared here will be helpful to you in conquering your mental blocks when they arise. Of course, this is not a comprehensive list. There are many more techniques available to try that are just a Google search away, and no doubt you have your own favorites that you like to use as well. Tweet your favorites to us @martiancraft!

Additional Resources

Evan Stone

Senior iOS Developer

MartianCraft is a US-based mobile software development agency. For nearly two decades, we have been building world-class and award-winning mobile apps for all types of businesses. We would love to create a custom software solution that meets your specific needs. Let's get in touch.