How I Navigate Joyless Coding

For most of my past ten weeks at the Recurse Center, I’ve been having a lot of fun exploring new ideas and projects, and eliminating a few bad coding habits I’d picked up during my time in academia. This time has been productive and enriching – I will be walking away from this program a much stronger developer than when I arrived. But the last week has been challenging for me. As I’m preparing myself to enter the job market, I’ve been approaching my code as “a fatiguing variety of things which [I] can barely keep together”† rather than as a joyful exercise in growing as a programmer. Here’s how I respond when I’m feeling frustrated or uninspired.

Pause. The first thing I do is check in with my body. Sometimes the solution is as simple as noticing I’m thirsty and taking a drink of water.

Take a walk. I’m not a programming machine, I’m a person who programs. Taking a walk can be a really useful way to remind myself that I don’t need to solve every problem immediately. Often, giving my brain a break helps it to relax enough to take a new approach to my project after I get back. Usually I go get bubble tea during my walks, because the shop is close and there’s nothing like giving myself something tasty to remind myself that programming is pretty sweet, too.

Refocus on learning. I tend to regain my inspiration when I’m learning something, and every challenge in my code is an indication that I have something to learn. Orienting myself toward learning can take a lot of different forms; some of my favorites include watching PyCon videos and writing down questions I have about my code. For instance, one of the problems I’m currently solving is how to clean a somewhat messy bit of JSON I’ve scraped from a website. As I refocused on learning, I realized that I’d never taken the time to properly figure out how JSON is formatted or how Python’s tools for parsing JSON work. Defining that set of questions gave me a concrete, learning-focused mindset with which to start tackling my problem again.

Give myself space to make mistakes. A surefire sign that I’m about to feel unmotivated to code is when I’ve stopped giving myself permission to write bad code. It’s really hard to write clean, organized, and well-designed code on the first try – that’s why refactoring and testing are such important parts of the process. And when I’m applying pressure on myself to write good code immediately, I’m much less likely to write anything at all. So when I’m feeling really stuck, it’s important for me to take whatever time I need to remind myself that I don’t have to be perfect, I don’t have to know everything already, it’s okay if I make a mistake. Mistakes are inevitable if I’m taking the risks necessary to become a better developer. Pointing that out to myself goes a long way toward re-engaging myself with my projects.

Talk with someone else. Often talking out a problem will bring it into focus. The Recurse Center places a lot of emphasis on pair programming for this reason. Communicating what’s going on, and asking for help when necessary, can turn a significant and deflating roadblock into a much more manageable challenge. And when I’m just feeling uninspired, talking about a problem with someone else can remind me of why I got excited about a project in the first place.

Remind myself of my goals. At the beginning of every new season of my life (a project, a job, etc.), I’ve developed a ritual in which I write down personal and professional goals for what I’d like to learn and do during that period of time. Some of these goals are very specific (e.g., “build a Twitter Bot that parodies herbal tea descriptions”) and some of them are much more ill-defined (e.g., “learn to take my emotions in stride without ignoring them”). When I’m feeling frustrated and other methods of engaging with a project aren’t working, it can be very helpful to return to my goals as a reminder of where I want to be growing during this project. That can help reformulate my questions about the project or even just remind me there was a reason why I started doing it.

Keep myself accountable. A occasional sense of ennui/laziness is pretty normal, even for projects I find super-exciting. One of my favorite ways to counteract my own inertia is to document my learning publicly. I’ve made a promise to myself that at the end of every day of coding, I must post something I’ve learned to Twitter. Regardless of how I’m feeling, I have a record of my own progress, and a way of ensuring that I don’t spend even a single day slipping into stagnation.

Just do it. Sometimes the best way to get back into the flow of programming is to open my IDE and start programming. I might try to take my coding five minutes at a time – usually the first five minute chunk is enough to push my brain back into my project. I have a playlist of fun dance music I listen to during these times too! There’s nothing like dancing in my chair to bring me back to the joy I experience while coding.

Cheesecake

† Henri Nouwen, “Making All Things New: An Invitation to the Spiritual Life

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s