How To Get Over Mental Blocks While Programming

If you have been programming for any amount of time, you know what it’s like. You’re sitting in front of the computer, with absolutely no idea how to proceed. You may have tried a few things, but some error keeps popping up. Or more annoyingly, nothing happens.

It doesn’t matter if you are working on some trivial algorithm or a complex website layout, whether you just started or have been programming for a while. We all have those moments where things don’t work the way we want them to.

In this article I will share a few reasons why I think this happens, and ways to go about resolving them.

Before that though, there are two things that need to be said:

  • You are not the only one who faces these obstacles. Programmers around the world, irrespective of their skill level face mental blocks, errors and bugs. Encountering problems and being stuck is a normal part of the job profile of a programmer, whatever your chosen specialisation be. What matters is how you go about these obstacles. As Alfred says in the movie Batman Begins (2005): “Why do we fall sir? So that we can learn to pick ourselves up.” On a side note, I suddenly feel old.
  • One way of looking at problems and being stuck is that it is a sign that you are working on something you haven’t before, and that you are growing. If you keep doing the same thing, eventually you won’t ever be stuck at it. And this is incentive to practice more. But if you want to grow, and growth is good, then you must accept that you will stumble along the way. I personally remember how I used to feel stuck when I was learning python, my first programming language. Looking back, they were trivial problems. But that is what I feel now, back then that was something I had to face and learn from, as I am sure you will too.

Now, to the list!

Why do we get stuck and what to do about it.

1. Maybe you are just tired.

Programming is an activity that requires you to be focused. If you are sleepy or hungry, you won’t be able to perform at your best. Or perform at all. And that will reflect in your work. This is no surprise, we’ve all been there. You can barely keep your eyes open, your back is hurting from sitting too long, or maybe you’d rather be having dinner than trying to figure out why your div isn’t in the centre of it’s container.

Make sure you get your sleep and eat and drink water on time. You have to respect your body, and if you do, your body will reward you back by being alert and ready to solve problems as opposed to being sluggish and not being able to understand a sentence despite reading it three times.

2. Are you really paying attention to the problem?

You might have been trying to debug your code for an hour, but have you really been giving it your 100%? Or have you also been thinking about the fight you had with your significant other? Or maybe what you will have for lunch. If half your mind is somewhere else, you will find it difficult to make progress with your work. You are after all only giving a part of your attention to the work at hand.

If you find yourself in this situation, take a break and try addressing what’s keeping you from concentrating. Because if you don’t, you’re neither going to be able to work properly, nor are you going to make progress with what’s taking up half your brain. A lose-lose situation.

3. Perhaps you don’t know the concept.

It is possible that the problem you are trying to solve requires a concept that you haven’t studied yet. You may know all HTML tags, but that isn’t going to help you make a three column layout, you need CSS for that. Alternatively, you may have studied it, or at least you tell yourself that. Did you really pay attention to that video on media queries or were you, as Joe calls it, “Netflixing it”. That is, treating the video as some sort of movie or TV show where you are a passive spectator.

If it’s the former, you should know that Google is just a tab away. Anything you want to learn, it’s available. If it’s the latter, you should go back to the material and be more active in trying to understand and absorb the information. Don’t skim through study material. Don’t go ahead if you haven’t understood the topic. Don’t be afraid to try out what you just learned. You can move slowly, taking your time to understand concepts and go far, or try to go fast for the sake of completion but then forget everything in a couple of days. Choose one, choose wisely.

4. You are stuck in the same thought loop.

As humans, we solve problems by breaking down the complex into the simple, and then address those mini problems. We draw from our past experiences. But if, for whatever reason, you find yourself in a situation where you are constantly trying to solve the problem with the same (wrong) approach, you could stay there the whole day and not be able to do it. You could keep thinking that perhaps you haven’t used the right CSS property, when in fact there was a typo in your CSS rule.

This is where the rubber ducking method works. You try to explain what you are working on and what problems you are facing to a rubber duck, a pencil, the wall, or another person. The reason this works is because the very act of vocalising your thought process helps you to break out of any loop you may have been stuck in. Alternatively, you can get up from your chair, go take a walk, or just go about your day not thinking about the problem. When you come back, five minutes later or a day later, you will be able to tackle the problem with a more openness to take different approaches, since you won’t be as invested in that same loop anymore.

5. Maybe you are looking in places for solutions where none exist

This is similar to point number 3. Except this has to do more with the limitations of any given resource. Take for example the drop down menu. Most websites have one. But most CSS courses (that I have seen) don’t teach it to you. You could have completed some course on CSS thinking you’re an expert now, but you can’t be an expert in something you have never done before. This has happened to me, and was the reason I stopped studying web development for a few months. I kept expecting to be able to make “perfect” websites after just one course on HTML and CSS each. I didn’t realise that knowing something and being able to apply it are two different things.

You see, no single course or resource can teach you everything. But that’s okay, because you are not limited to any one. In my case, the solution was to first learn the basic concepts, and then do a google search for “css drop down menu”. Whether you learn from W3 Schools, Youtube or any other resource doesn’t matter.

Wrap up.

And that’s it! These are the things that I have learned over time. I hope these tips will help you in accelerating your progress. And remember, practice makes perfect! As far as problems go, you only need to solve something once for it stop being a problem. Because if you encounter it again, you already know what to do!

Written by Syed Adil Ahmed

What do you think?

Written by CodingPhase


Leave a Reply

Your email address will not be published. Required fields are marked *





Back Blogging

Install laravel in windows 10