Have a Break

I’m going to start this blog with a very obvious statement. Software can be really hard. If you care about writing good software, you’ll find it far more difficult than someone who doesn’t care. The reason why software is hard is because most of the time, we are staring into the abyss and doing something we probably haven’t done before.

  1. We are either working on a new project/feature where we are designing how the major components (or objects) will work together.

  2. We are using a third-party library that we haven’t used before.

  3. We are writing some algorithm we haven’t attempted before

  4. We are making some change to an existing application that we are not familiar with

Software can at times feel like a voyage of discovery, whereby you’d have some vague idea of what you want to achieve but no exact plan on how to get there.

As paradoxical as this may seem, the major part of software development isn’t actually writing code. It’s thinking about how to write code.

This is how it should be. If you are typing code very quickly without putting much thought into it, the chances are that your solutions will lack elegancy and be harder to work with later on.

Because so much time is spent on thinking, it’s really important to take regular breaks. It’s hard to work at full efficiency for long durations without getting tired/lost in the problem we are trying to solve.

This is particularly important if you are stuck on something. Many of us would have had those days whereby we are really stuck on a problem and are making no progress.

When this is the case and we are under pressure, we feel that taking a break will lose us time and add to the stress.

But in reality, when you are stuck for a long time, you get frustrated. You just want the thing to work now, you may have other tasks you wanted to get done today.

When I’m at the point where I’m stuck and starting to feel the frustration, I stop what I’m doing. I go and play foosball or take a walk.

When I come back a bit later, I feel I’m more able to tackle the problem at hand.

How many times have you spent an entire day on a problem, got nowhere, and then the next morning you got it working in no time at all with a tiny amount of code?

How many times have you had a eureka moment whilst in the shower?

Because we spend so much of our time thinking whilst coding, it’s important to keep our minds fresh.

Coding is not a mechical task, but an intellectual task, and is important that we are at our most effective whilst doing this.