Graham's Blog

Coding With Depression

Nov 11th, 2022

One of the reasons I started this blog, aside from wanting to share my thoughts and experiences as someone early in my web development career, was to write about mental illness as it relates to development. As you can imagine, it’s not an easy topic by any means, as it’s something that profoundly affects me personally on a daily basis.

For a decent chunk of this past week, I’ve been struggling with a bit of a depressive episode. For me this manifests as lack of motivation, and especially “brain fog”, which just kills my logical thinking and problem solving skills. Obviously this is not ideal for web development, but I’ve found ways to make it work and maintain some level of productivity, even if it’s not my absolute best.

Getting Motivated

The first step to overcoming anything is showing up.

Whether I’m laying in bed wishing I could just go back to sleep, or sitting at my computer struggling to make myself just open my code editor, I have to find a way to get myself motivated. When I’m hitting these low points, I’ve found it incredibly helpful to break things down into tiny pieces and just work through them a piece at a time.

If I’m struggling to get out of bed, instead of trying to motivate myself to get up because I need to go to work, I focus on the process one step at a time. It’s far easier to motivate myself to do a bunch of little things in sequence than it is to motivate myself to reach the end goal.

This even applies to just tackling things throughout the day. Today I had a rather large task to complete, and I was simply not motivated to do it. I took it one step at a time, down to the most mundane steps like executing a CLI command, or opening a file. I didn’t have to be motivated to finish the task as a whole, I just had to motivate myself to tackle each step until I finished.

Brain fog is a complicated one. I first experienced the impact it has on coding when I was working on homework for boot camp. It’s resulted in me blankly staring at a block of code and just totally forgetting how to read it, or just forgetting the name of a variable I defined less than a minute earlier.

It’s so unbelievably frustrating to experience. The knowledge required to understand the code, the ability needed to problem solve the issue, it’s all in there somewhere but it feels like that particular brain function is out of scope.

One of my bad habits to tackle this problem is coffee. I hate to admit it, but it does help take the edge of the fog.

Firstly, I’d suggest some preventative measures like sleeping, getting some sun when you can, and using a light therapy lamp in the morning on those dark rainy mornings. It seems obvious, but it’s worth mentioning these things help manage depression, and, by extension, brain fog.

But if you’re in the moment, the best thing you can do is just step away from the computer for a few minutes. Get up, stretch, walk around, do some jumping jacks, go outside, whatever you can do to just get away from the problem and get your body moving. It’s good advice for anyone facing a programming problem, but it’s especially good if you’re struggling with a bit of brain fog.

Be Kind to Yourself

Through all this, the most important thing to remember is to be kind to yourself.

I tend to be extremely self-critical on the best of days, but when I’m struggling and not producing my best work I am even more so. I have to remind myself that this isn’t typical, I’m not lazy or dumb, I’m just having a rough time. It’s ok to slip up here and there and not be at 100% peak productivity, because I’m doing my best and I’m getting stuff done despite the challenges.


This post was originally published on my (now defunct) blog on my portfolio site ghall.dev, and was republished here for archival purposes.

Mental Health Web Dev