200 Words A Day archive for 2 full years. 731 days of unbroken consecutive days of writing. 7 Dec 2018 - 8 Dec 2020. I now write daily on https://golifelog.com

Mindful coding

After the past few months of coding daily, I’m beginning to notice a bad coding habit starting to emerge. I call it zombie mode. Usually it starts when I hit an error, and I jump right into troubleshooting it. I google for the error message, and browse through the results and start to fall into a rabbit hole of the internet. After the third or fourth results, my eyes start to glaze over. My brain start to turn to mush, exhibiting signs of information overload. Classic cognitive overwhelm. And I just sit there flipping through web page after web page, really determined to solve the problem, yet not really thinking clearly to hunt down the right answer, but just kind of mindlessly consuming and being bounced around while in this “zombie mode”. It’s not the best for productivity, and it’s mentally draining. 

The funny thing is, sometimes I get up to go to the bathroom or have a water break by happenstance, and usually that’s when some small breakthrough will surface in my head. Or it might happen when I’m rubberducking – writing down the issue to ask for help on a forum or from friends. The point is, whatever that gets me out of mindlessness back into a state of being alert and mindful, is usually the breakthrough. And that’s great because now I get to apply some of the mindfulness practice techniques I use in daily life, to coding. 

Some ideas I have now on how to do mindful coding:

The longer my coding session runs, the harder I should be practising mindfulness. Because any bug that takes more than 30min will start to tire me out, so I should start taking attention breaks to think clearly rather than continuing to burrow down head-first. I should be approaching it like short intense sprints of hard, clear thinking, rather than a marathon of low to moderate mental effort. So water breaks, bathroom breaks on timer when coding.

Use a timer to introduce hard attention breaks into the screen. I use a Mac menu bar app called Tadama, that blanks out the screen with a 30s countdown timers every 30min. For a while now I kept turning it off as it felt distracting (especially when writing), but maybe when I start any coding I should toggle it back on to help me break out of zombie mode should I fall into it unknowingly.

Sketch it down, write it on paper or type out the issue as I would when asking someone else for help. That brings my mind back to a state of meta-cognition and observer mode, so that I can think clearer. 

List out the questions I have about the error and the results that come up, and be methodical in searching for each one by going down the list (instead of randomly bouncing around web pages). 

Any other suggestions for mindful coding?