How to deal with distractions while programming?

Programming is a creative process by definition. But when we are programming, it is all too easy to get sidetracked by distractions. This article will show you the only working method of dealing with distractions and staying focused on the task at hand!

People riding a train. All of them look at their phones.
Photo by Hugh Han on Unsplash

Programming is a creative process by definition. But when we are programming, it is all too easy to get sidetracked by distractions.

This article will show you the only working method of dealing with distractions and staying focused on the task at hand!

What can you do when you are distracted?

You have seen a lot of hints, haven't you?

People say you should block websites you don't need. Some tell you to wear headphones and listen to music. Others suggest scheduling time for dealing with chat messages and emails. Sure, you can try it.

But I bet you have already tried some of those hints, and they didn't work. That's why you ended up on this website. I bet it wasn't the first one you opened. Is there anything else you can do?

We have at least two kinds of distractions at work

First, your task may not be too challenging, so you get bored and look for something to read or watch. The other kind of distraction is being worried. Is there something troubling you? Do you have a hard time focusing because of it? What should you do when you have a personal problem you keep thinking about?

How can you prevent personal problems from distracting you?

You won't like the solution I will suggest.

The best way to avoid such distractions is to take a day off (or a week off) and deal with the problem.

Of course, it may not be easy. If you have a health problem, you won't fix it in a week. It may be too short to even go to a doctor. At best, you may get the visit scheduled. But you will have to plan the visit anyway, so why don't you do it as soon as possible?

You can't solve all personal issues in a day, but you can at least take one action. Even only one step may help you deal with your situation. It may be enough to restore the sense of control over your life... or the illusion of control.

After all, having a problem and doing something about it (anything) is better than having trouble and doing nothing but worrying.

What if you worry about something you have no impact on? It may still be a health problem. But, this time, someone else is sick. You can't force other people to do anything, so all you do is worry about their health. That's tougher.

Yet, I would suggest dealing with the things you can change. In this case, it is your reaction to the problem. You will have to learn to deal with it. It may require asking a psychologist for help or talking to a therapist or a priest. Whatever works for you. So spend your day off taking this action.

If you worry less or detach from the problem, you may see solutions clearly and help even more. Of course, it may be too hard. Being worried about someone else is the only distraction that may be too difficult to deal with. It's ok. It means you are a human being.

How to deal with other distractions?

What if you don't have a severe problem but still can't focus on work? Do you watch YouTube instead of working? Do messages from colleagues distract you? Are you playing video games instead of working?

Set a short deadline.

Seriously. Do you remember how you were preparing for exams? Ok, I know. Some of you may be the people who studied two hours a day every day. However, most people studied for four hours the day before the exam. And the results were good enough.

That's the catch. The results will be at most good enough, but at least you will make some progress. Still better than being distracted and doing nothing.

If you have a task you don't want to do, decide how much time of continuous work you would need to finish it. After that, you cut your estimated time by 20%. It will be your deadline. A private deadline! Don't share it with anyone!

Our goal is to turn the tedious task into a game.

Can you finish the task in a limited time? Aren't you curious whether you can do it?

If you succeed, it will be great! You will have the task done and still have enough time to succumb to the distractions. This time you can do it guilt-free.

Suppose you fail. Not a big deal. Nobody knew about the deadline. You made substantial progress anyway, and you can set a new deadline for the rest of the task.

How long can you do it?

If you succeed at turning focus into a game, you can probably continue doing it forever.

But if you have to force yourself to set short deadlines and keep working, you will soon hate this method.

In such a case, you will need to solve the root cause of your problem.

Why can't you focus on work? Why is it so dull? Maybe you should be doing something else, or the same thing but at a different company.

Those are valid questions to ask.

Answering them may be difficult.

You may not like your answers.