DEV Community

Victor Cassone
Victor Cassone

Posted on

How to create a focused coding environment

If you want to increase the odds of achieving your goal of becoming a programmer, it's important to craft a distraction-free learning environment that allows for long uninterrupted stretches of focus.

The environment where you learn to code has a large influence on your actions and your success.

Focus is a foundational component of memory and skill acquisition.

When you try to encode new information into your brain, the strength of the encoding is directly linked to the intensity of your focus. When your focus is weak, new information will be less sticky which will result in slower learning and more time studying.

Ultimately, having a distraction-free environment will accelerate your learning and help you achieve your goal in less time.

How to craft your environment

There's a pretty simple framework to follow when crafting a distraction-free learning environment. It relies on the Fogg Behavior Model that I talked about in a previous post.

To recap, the Fogg Behavior Model points out that a behavior occurs when three things are present at the same time: Motivation, Ability, and a Prompt.

Fogg Behavior Model

Motivation — Hopes, fears, pleasure-seeking, pain avoidance, social acceptance, and social rejection.

Ability — Your ability to perform a task, which includes: time, money, physical effort, mental effort, social deviance, and routine.

Prompt — An internal or external trigger that reminds you to do the behavior.

Since motivation is unreliable, you should avoid learning in an environment that requires a high level of motivation to be productive.

Instead, focus on adjusting the other two variables of the Fogg Behavior Model: Prompt and Ability.

1) Prompt

  • Remove Prompts that'll trigger distracting behaviors.

  • Add Prompts that will help you stay focused on coding.

2) Ability

  • Make your coding habit small and easy to do.

  • Make distracting behaviors harder to perform while coding.

At the end of the day, crafting a learning environment is a design problem. Each person will have different constraints based on their life circumstances. It will require some forethought and trial and error to get right.

Below are a few techniques you can use when designing your own distraction-free learning environment.

Find a location where you can’t be interrupted

I've found changing locations or simply coding in a designated workspace is a useful tool when avoiding distractions.

Our day to day life is filled with various people and objects vying for our attention. Whether it's our gaming systems, friends, family, the dirty dishes.. etc. They all want our attention is some shape or form.

The best way to avoid getting sucked into one of these distractions is to find a location where they have no influence over us.

As the saying goes "Out of sight, out of mind."

If you're not around something then it can't prompt you to interact with it.

In normal times, I'd usually do a lot of my coding in a nearby coffee shop. The coffee shop allowed me to get away from the distractions of my home and put some distance between friends and family.

Since the outbreak of COVID-19, I don't have that option. I've had to create a designated workspace at my home that allows for a similar environment.

I sit outside when the weather is nice. When it’s not, I post up in the corner of my bedroom.

The main thing to avoid is TV and other highly stimulating surroundings that might prompt you to change tasks or grab your attention.

Ideally, you’ll want a location where nothing unexpected happens.

If you can’t avoid a distracting environment, a pair of headphones can go a long way

Headphones not only remove the surrounding noise but they also signal to the people around you that you’re busy and shouldn’t be bothered.

Airplane mode + Site blockers

The digital world needs to be managed with the same effort as the physical world.

Cell-phones and the internet are one of the biggest distraction creators of all time.

Social media and news companies have teams of employees whose sole job is to figure out ways to grab and hold your attention. Through algorithms and psychological tricks, they've become dangerously good at their job.

The internet in its current form is designed to distract you. Relying solely on willpower is a losing battle against its attraction.

The best thing you can do is remove the need for willpower and block access to these distracting apps and websites outright.

When you’re coding, put your phone out of sight and in silent/airplane mode.

There are various services you can use to block distracting apps and websites. The ones I've found useful are listed below...

BlockSite (Chrome Extension)

StayFocusd (Chrome Extention)

SelfControl (Mac App)

Freedom (All platforms)

Find a quiet time of day

Sometimes, changing the time of day of when you code can have a big impact on your focus.

Find a time of a day that you feel you have the most control over. For many, this time will be late at night or early in the morning. But it can also be over a lunch break or when the kids are napping.

When I was teaching myself programming, I'd wake up at 4:30 am every day because I knew no one would be trying to contact me and there was nothing from that day I needed to do yet.

This early morning coding habit allowed me to consistent and focused which ultimately lead to my success.

Have a notebook nearby

Sometimes it's hard to focus because our minds are worried about other things.

We'll be working on something and out of nowhere, we can't stop thinking about the dinner plans for tonight or something that happened 5 years ago.

One way to avoid being lost in thought is to write down any tasks or ideas that pop into your head. I use a plain notebook but you can also use a note-taking app.

I've found writing down my thoughts magically helps me move past whatever I was thinking about. It allows me to come back to the idea at a later time and helps me avoid being stuck in a rabbit hole of random thoughts.

Conclusion

Above are just a few personal examples of how you can craft a distraction-free learning environment.

When crafting your own learning environment, remember to use the Fogg Behavior Model from above. Focus on adjusting the Prompt and Ability variables in the formula.

Once you’ve found a learning environment that suits your needs, do everything you can to make sure distractions don’t start creeping in.

If I missed anything, I’d love to hear your thoughts in the comments below.

Make sure to follow my alter ego Zero to Programmer on Twitter.

Top comments (0)