A dev's guide to meditation - part 2
Tags: career, productivity, worklifebalance, programming
Published: 2019-03-29 06:04:13

---
title: A dev's guide to meditation - part 2
published: true
description: Why meditation might help you code
tags: #career #productivity #worklifebalance #programming
cover_image: https://d15mu8qrd5jnh5.cloudfront.net/wp-content/uploads/2018/02/hands.jpg
series: Meditation - a dev’s guide
canonical_url: https://codingmindfully.com/ultimate-guide-part-2
---

> This is a serialisation of a guide to meditation for programmers that I first posted over at [CodingMindfully.com](https://codingmindfully.com/ultimate-guide). If you can't wait for the full series to be published, head on over and download your free PDF copy!

<h1 id="content-2">How meditation makes you a better coder</h1>
There are three main ways that the skills I have learned in meditation directly apply to my coding activities. They are:
<ul>
 	<li>Increased focus through distraction management</li>
 	<li>Stress management through relaxation</li>
 	<li>Optimising experience through self-awareness</li>
</ul>
<strong>Increased focus
</strong>I lose focus all the time. This might sound strange coming from someone who has meditated for a good chunk of his life, but it’s true, and will continue to be true. But I still know that meditation has helped with my ability to stay concentrated on coding tasks for extended periods - which is bloody useful!

Like most humans, I find my mind off-task multiple times a day. There are a couple of major ways I find myself distracted when trying to cut some code.
<ul>
 	<li>Internal distractions, such as getting caught in a rabbit hole of thoughts or feelings - in particular frustration (sound familiar?), but also anger and shame;</li>
 	<li>Research distractions - a simple query of Stackoverflow turns into a full-blown YouTube binge or a reddit gravity well.</li>
</ul>
Mediation doesn’t mean I never get distracted. But learning to meditate has given me a better relationship with distraction. In general
<ul>
 	<li>I get distracted WAY less;</li>
 	<li>I notice it has happened FASTER than I used to, which means I waste less time;</li>
 	<li>I find it MUCH easier to direct myself back onto the task at hand.</li>
</ul>
All of this means I’m able to devote much more of my productive time to getting what I need to do, done!

<strong>Stress management</strong>
I’ve worked in some stressful jobs, and some less stressful jobs. The first job I had out of university I once worked a 21hour shift! I got rid of some bugs, but I definitely introduced some more.

Even in the best of environments, it’s possible to push the stress levels to uncomfortable levels from time to time.

There is no doubt - the foggy mind, elevated physical tension and emotional reactivity associated with the condition of excessive stress get in the way of writing solid code. We need to think clearly to code clearly!
<div class="border border-primary p-4 mb-5 text-secondary"><strong>Meditation has trained me to become aware of the subtle mental and physical indicators that tell me I’m on the verge of being over stressed. Conveniently, the practices themselves have taught me how to de-escalate my nervous system in a reliable and portable way. </strong></div>
<strong>Optimising experience
</strong>My overall experience of life has been enhanced and improved by my meditation practice because it has taught me self-awareness.

As a result of this continued study of my breath and my body, I’m more aware of my state of being on a moment by moment basis.

I can tell when I’m feeling anxious, or sad, or happy, or frustrated, or giddy, or distracted. Many times a day I remember to ask myself - how am I feeling right now?

Whatever it is that I’m feeling, I can evaluate whether that state is useful or not, and perhaps choose another way to be in the world. I can optimise my experience to suit the circumstance.

Say I’m pissed with a co-worker or client. Perhaps I notice that anger as a physical feeling of rage, and a desire to lash out.

Knowing this is powerful. I can make a call on how best to use that anger. Lashing out might not be the best thing to do - perhaps a more measured approach might serve my long-term interests better. Because I’m aware of my anger, I don’t have to be controlled by it.

Or I find myself frustrated and disheartened during a bug hunt (who hasn’t been there?). Instead of needlessly persisting or turning on my “inner critic” (you know the voice - the one that says you’ll never be able to fix it), I give myself a break and return to the problem refreshed, or talk to a teammate and we fix it in minutes.

Self-awareness leads to better decisions and a smoother experience of life. It’s a superpower!
<h1 id="content-3">How to meditate - the Standard Meditation Algorithm</h1>
Meditation utilises a fundamental capacity of the human mind - the capacity to direct the attention - to maintain awareness of the breath and/or the body for a sustained period.

Meditation is a deliberate, intentional act. To meditate, you decide that you will carve out some time from your day.

During meditation, you maintain a mental intention to remain aware of your breathing, or some aspect of the sensory world of your body, as best you can, for the period of meditation.

At the heart of every meditation practice is something I call the Standard Meditation Algorithm. If I were to write it down in code, meditation would look a bit like this (please ignore the potential infinite loop!).

&nbsp;

<img class="alignnone wp-image-326 size-large" src="http://d15mu8qrd5jnh5.cloudfront.net/wp-content/uploads/2018/10/sma_edit-1024x862.png" alt="" width="1024" height="862" />

&nbsp;

At a high level, what you need to do is:
<ul>
 	<li>Set aside some time in your day to intentionally practice meditation - typically 10-25 minutes is about right;</li>
 	<li>Deliberately relax the body;</li>
 	<li>Direct your attention towards something - typically we use the breath, or the sensations coming from the body, but there are many other options - we’ll go into this in depth below;</li>
 	<li>Watch how the mind quite naturally resists staying focused (it's crazy in there some days) - it WILL wander, this is 100% expected and you will notice it happening;</li>
 	<li>Restore your attention as the mind wanders - maybe ten times, maybe a hundred, maybe a thousand! The number really doesn’t matter - as long as you remember to redirect your attention back to your meditation from time to time you are meditating 100% correctly;</li>
 	<li>When you emerge from your session, check in with yourself and notice what’s emerged as a result.</li>
</ul>
<div class="border border-primary p-4 mb-5 text-secondary">

Here is the most important thing that anyone will tell you about learning to meditate - it doesn't really matter if it wanders, what matters is that you bring it back.

<strong>This is so important I’m going to say it again, this time in bold. It doesn't really matter if your mind wanders - what matters is that you bring it back, gently, without self-reproach. </strong>

</div>
MANY people find this process relaxing, often finding that their focus has improved, or they feel mentally clearer (such important qualities of mind for a programmer).

You can try it right now. Close your eyes, relax your body deliberately with a few sighs or yawns and just focus on the next ten breaths you take - about a minute or so (you can count to yourself mentally).

Just feel where you notice each breath in the body, whether it's fast or slow, deep or shallow, in the nose or in the belly.

Don't worry about getting it right - treat it as an experiment. See how you feel after - perhaps even just a little more relaxed? Maybe, maybe not but be curious. Either way, you just meditated.

Once you're done, you can check in with yourself and notice the effects. Remember I asked you about why you were reading this guide? Does how you are feeling now tie in with that goal?
<div class="border border-primary p-4 mb-5 text-secondary">

<strong>This paragraph contains maybe the most important thing you’ll ever learn about meditation, so pay attention.</strong>

<strong>This is very important - success in meditation is NOT ABOUT STOPPING MIND WANDERING. The mind will wander, that’s entirely natural and expected. </strong>

<strong>Meditation is much more about NOTICING THAT THE MIND HAS WANDERED and then, gently, restoring focus to the object of meditation itself. </strong>

</div>
If you do that ten times, great. If you do it a hundred times, great - you still have a 100% record of noticing distraction and getting back on track.

It’s a bit like driving a car - every so often you notice your trajectory and make a little course correction to stay on the road, nudging the steering wheel or altering your speed.

Except what you’re “steering” is your attention. It won’t always stay on your breath or body by itself, so you just gently nudge it back in that direction when you notice you’re off course.

<h1 id="content-5">Practicing Meditation</h1>
So, enough talk. Let’s get down to the business of meditating. In this section, we’ll introduce two meditation practices that apply the Standard Meditation Algorithm.

The type of meditation we introduce here uses a very fundamental capacity of the human mind - the capacity to pay attention. To meditate in this way is to selectively tune our attention to be aware of a particular thing, and to remember to redirect and refocus our attention as it naturally wanders.

<strong>I’ve created a few companion meditations for you to practice with. You can access them at </strong><strong><a href="http://codingmindfully.com/download-guided-meditations/">this link</a>.</strong></strong>


Here's one of the meditations as an embed. Try it out and let me know how you go.


{% soundcloud https://soundcloud.com/codingmindfully/mindfulness-experiment %}

Stay tuned for part 3.

> This is a serialisation of a guide to meditation for programmers that I first posted over at [CodingMindfully.com](https://codingmindfully.com/ultimate-guide). If you can't wait for the full series to be published, head on over and download your free PDF copy!