What to do when code is not working as expected and you’re losing your nerves

Whether you admit it or not, if you’re a developer, I am sure you have experienced a feeling of complete hopelessness.

I guess this is Gordon Ramsay

You are sitting comfortably in your chair looking at those few lines of code that do not seem to work from no apparent reason and you are about to grab your notebook or monitor and throw it either at a wall ahead of you or out of window.

Don’t worry, happens to every single developer. But what makes a difference in the quality of your life and life other developers is how you handle the situation.

Of course, emotions are high, but they are going to be gone in a while and your accountant will be wondering why you had to purchase a new notebook or a monitor.

Let’s do this instead

I am not going to tell you to take a break or go do something else. I am going to tell you to keep pushing until you solve the issue.

BUT – the most important is how you approach it. You should approach your problem solving situation like so:

  • once you realise you are spending too much time solving the code problem or fixing the bug — set your times to 3 minutes. Give yourself 3 minutes of time to solve the issue. Once the time passes, you move one.
  • If you did not manage to solve the issue, who cares, you are going for a coffee, maybe a walkie.. .whatever, just get your mind off the the problem you’d been solving.
  • Get back when you feel comfortable (but get back, ideally after 10 minutes).
  • And repeat the process until you manage to solve the issue.

The solution

…has always come and is going to always come. That’s it. It’s code. There is nothing in the world that has not been solved when it comes to programming.

Give it a try and let me know in the comments below how it’s been working for you.

Until next time,

yours in coding,



Leave a comment

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