It’s midnight. You’re huddled in the restricted section of the library, eyes glued to powerful tomes—Creating Killer Websites! Resilient Web Design! The Pragmatic Programmer! You get a missive from your co-conspirators in the Late Night Code Club… another night of adventurous learning is about to begin.
Wait, why am I getting this email?! Welcome to the Late Night Code Club, a newsletter about learning programming together. You likely signed up for this newsletter after reading one of my posts on Dev.to or elsewhere. I haven't written here often, so please allow me to reintroduce myself. I’m Kevin McGillivray, the writer of this newsletter and your jaunty host. I’ve been a web developer and software engineer for over ten years, and I’ve helped dozens of people as they deepened their knowledge and skills in programming.
In this newsletter I hope we can share the ✨forbidden knowledge ✨ necessary to learn how to write code—the arcane secrets that are hidden between the tutorials and Twitter threads, and helpful perspectives for the moments we feel stuck, frustrated, or discouraged. Thanks for being here, and if you’re new to the club, you can subscribe here to be notified of new missives.
One of my favorite ways to explore mindfulness is to integrate a mindfulness exercise into an everyday activity—washing dishes, driving a car, eating dinner, sweeping the floor. As the Zen saying goes, "Chop wood, carry water."
Since I spend so much time writing code, I've been experimenting with ways to connect mindfulness exercises to daily activities related to programming.
Besides being a way to have a more mindful day overall, practicing mindfulness in proximity to programming can help with many common situations that arise when coding. Writing code is a complex experience—it often requires a high level of focus, and moments of frustration or confusion can often bring up strong emotions and mental cloudiness.
Getting stuck for hours with mounting frustration
Frustration when learning new skills or concepts
Having a hard time stopping when hooked on a project
The complications of collaborative projects (distraction, communication)
Getting bored and losing interest in a project or programming in general
Here are a few of the mindfulness exercises I've experimented with. Many of them are simply ideas to start from, so if you try them please experiment with them and let me know how it goes!
Meditation bookends
Start each coding session with a few minutes of sitting meditation and end each session with a few minutes of walking meditation.
Pre- and post-commit breathing
Take three deep breaths before and after each Git commit and Git push.
Pull request gratitude
When creating or reviewing a pull request, take a few deep breaths and repeat a mantra that is focused on gratitude and kind speech. Here are some ideas that are loosely based on mantras from Thich Nhat Hanh's book, Work. I would recommend coming up with your own, formal or informal, to match what you prefer!
When reviewing a pull request:
Reviewing this code,
I am grateful to those that wrote it
and for the tools that were used to write it.
May this code bring health, peace, and well-being.
When creating a pull request:
Code can travel thousands of miles and affect many people.
I vow to write code mindfully and lovingly.
May this code create mutual understanding and peace.
Tab sweeping
When ending your work for the day or switching to a new task, review each open tab in the browser and text editor and close each one that you don't need while taking a breath.
Daily writing
I've found that daily writing (such as 750words.com) is one of the best mindfulness exercises and maybe helpful to integrate into a daily routine.
Let me know if you try any of these exercises and how it goes!