Slow down to code faster
Tags: codequality, mentalhealth
Published: 2019-09-03 17:35:56

The more I code and the more I tend to slow down. And curiously enough, this makes me code faster and be more productive. 

As an autodidact with an almost ADD-ish personality, I was inclined to use the backspace a lot. Test something, see the error, fix it, repeat. Then, there was always this moment in which I was getting stuck, and my frustration grows accordingly. As I was getting more and more into the [tunnel effect](https://en.wikipedia.org/wiki/Tunnel_effect), I was often trying to test a hundreds solutions in a few minutes, only to give up quickly and try something else. Then, my only way out was literally to go for a walk, only to come back at my work when I was relaxed and realize that the solution was simple as that. 

![Good ol' meme - guy looking skeptical staring at his computer](https://thepracticaldev.s3.amazonaws.com/i/pc7gqweg8y3a2py0m8z9.jpg)
I wouldn't be the first or the last person suffering from this. As I moved from university to a career in tech, I had to adapt. Here is a few things that helped me to structure my practice and become a better coder:

Pomodoro technique
------------------

The human brain (or at least mine) can only focus on something for half an hour. The [pomodoro technique](https://francescocirillo.com/pages/pomodoro-technique) is a time-management methodology based on that fact. The idea is quite simple - a pomodoro is an unit of work, typically consisting of 25 minutes iterations and a 5 minutes break. If you loose focus during your pomodoro, you're supposed to cancel it and start over. Not going to lie, when I'm passionated by a project, the opposite tends to happen to me - I tends to overlook the pauses and end up depleted. Nevertheless, one of my main advantage is that you can link it to your project management, and focus on the task at hand. For example, why not using [Taiga](https://taiga.io/) story points to estimate the time a specific task will take?

Coding logs
-----------

One of the main reason I went for an university master in psychology instead of doing like the rest of my high-school class and starting a bachelor in comp.sci is the kindergarden-schooling style there. They had assignments, couldn't talk during class, mandatory presence, and so on. But worst, they *had written. coding. exams*. They had to implement algorithms with a good ol' pen and paper. No way I was doing that.

But when I knew I wanted to code for a leaving, I realised how wrong I was. When placed in front of a problem bigger than my immediate attention span, I was lost. The solution? *A good ol' pen and paper*. I started doing a *programming log*. Everytime I was stuck, instead of trying the same thing different way, I started adopting a diagnostic approach. *What is the issue?*. *Where could it come from?*. *How can I test that?*. *Let's test it*. *Does it fix the issue?*. *What else could be the problem?*... and so on. By documenting everything I'm trying, I kept myself focused on the problem at hand and could be way more systematic - and in fine, way faster in fixing in the issue. 

![Logs](https://i.imgur.com/zAAshFl.png)

Slow down and stop touching this god'damn backspace
---------------------------------------------------

![Backspace](https://ak1.picdn.net/shutterstock/videos/24493871/thumb/1.jpg)

That's right. One of the things that I constantly have to reminds myself to do, and is a priceless help to me, is simply to *slow down*. Take the time to breathe before you push enter or click. Re-check the name of your variables twice before writing your code. Look at your whole screen, take one second before you type a word. This is dramatically improving my error rate. This is decreasing the time I spend looking for a typo, asking myself where the hell did I forgot something. And *in fine*, this will make you more productive.