Curing procrastination, one line of code a day

Between December 2023 and February 2024, I was working on a project, I had some idea about what I was working on and it was impossible for me to stop myself from working on it. Hours spent working on the project, seven days a week. Interestingly, after February I struggled writing any code for days. At first I thought I'd just run out of steam, inspiration or motivation to do any work. Which is partly true, but I still wanted to continue and get shit done per se. As I really enjoyed the process of writing code and making things.

Few months passed with almost no code written and nothing made. Coincedentally, it was also a dark time in my life this year. I tried doing something else, tried taking some time off, but it only felt worse. It got so bad that I decided to get clinical help, which also helped I'll admit. A few weeks later, something intereseting happended.

Just by dumb luck, I read or heard a line, from where or from whom I have no idea. But it essentially helped me understand why I procrastinated. It went along the lines of, some people procrastinate because they build up the thing that they want to do so much so that it starts to daunt them. It can also happen if the end result you are envisioning is one of perfection. When I heard this, I din think much of it, because I did not know what to do with this information. A week or so after, as I was having my coffee outside, I was procrastinating something I wanted to do (some piece of code I wanted to write probably), I remembered the procrastination line from earlier. Instantly I realized that, the work I was picturing was a complete one, one that would not be done in a week, let alone in the next few hours. Right then and there I decided on a simple rule, to write one line of code everyday. It sounds silly, but the first few days, I wrote exactly one line of code. Things escalated quickly, as I could no longer stop at one line. Whole modules would be written, before I even realized it.

Around the same time, I started another simple practice, to never improve things before I got the whole thing working. Usually, when I wrote a few lines of code, and I'd start optimizing it before the entire thing was done (usually a small piece of functionality). Before I knew it, I was stuck on a problem that did not need solving at the moment. I had to really stop myself from fixing them instantaneously and made the compromise of leaving a simple //TODO: fix this or //TODO: this code sucks, make it better. To my surprise, I could see simpler ways to solve certain problems after I had solved it once.

Obviously, none is this revolutionary. It's all pretty mundane and not sexy at all. But what can I say, it really works. It's been over forty days since I started writing code everyday, and I'm proud to say that I have not missed a single day. Some days, I found myself checking the time, it's 2am and I am still writing code. I've extended this realization to other aspects of my life to quite a bit of success.

I have read the atomic habits book, twice now, it's not until now that I really understand what the author was talking about. Context makes all the difference I guess.

Other areas that I have been able to apply this is my workouts. Every morning my only goal is to put on my training clothes, then do a warm up, if after that I don't feel like working out I come back home. I've never stopped after warming up so far.

Actions over Avoidance

As I was experimenting with building habits in other parts of my life, I also realized that I do better when there is an action to perform over avoiding a "bad" habit. Example, I wanted to reduce the amount of YouTube I watched, I wasn't able to break it down. Hence, I failed within the first week to keep this up. So instead I decided to meditate for at least a minute everyday. The two might seem quite opposing ideas, but I found it easier to meditate for a minute over not watching YouTube. So I guess in the end, the idea is to do more of the things you want to do, wherein you don't have the time or energy to do the things you don't want to. I'm not sure it works that way, nor am I an expert in the area. So, do your own experiments. Surprisingly though, I've found myself enjoying YouTube less, I guess I accidentally solved Y.