I've done mindfulness practices for several years since doing some DBT classes. They're not going to make you an instant algorithm whiz, jack up your lines-of-code-per-day by an order of magnitude, or let you code 24 hours a day non-stop.
But here are some things I've seen...
You become more effective at dealing with what's really going on
Would you try to install kitchen cabinets that are level and square and fit well together while wearing a blindfold and thick gloves? Would you drive on a crowded freeway while watching a TV set on your dashboard in front of the steering wheel?
We spend much of our lives distracted by thoughts of other times and places. But when we need to deal with things that are immediate, that's like a blindfold and gloves, or watching TV instead of the road. At times, it can be like trying to code while a dozen people are screaming at you.
Mindfulness helps us get rid of those cognitive distractions. So when someone comes to you with a programming task, you can actually pay attention and hear what they're saying, rather than the distractions in your head.
You develop mental self-discipline that helps you write necessary-but-boring code
Especially when bored, the human mind likes to jump around among thoughts like a puppy - sniffing at this, barking at that, rolling on the floor, and licking people it likes. That's fine if you're taking a nice peaceful walk outdoors, but is a terrible way to write code that is boring but just has to be done.
Mindfulness practice is like self-discipline weight-lifting for the mind. During a meditation session, you try to accept your mental puppy-ness and not punish yourself for it, but keep bringing your mental focus back to the meditation. Over time, your ability to concentrate increases, and so does your ability to crank out boring-but-necessary code.
You're much calmer when coding, and thus more productive
Our brains developed on the African savannah, where no matter what a hominid was doing, 10% of their minds needed to be watching out for cheetahs and lions to avoid being eaten. So when we think about other times and places, our minds often gravitate toward things that annoy or upset us: the deadline we might not be able to meet, the person we work with who's a jerk, the bad news that was on TV about something far away, or the disagreement with our significant other that morning. Those all tick over in the back of our minds while we're trying to program.
Mindfulness teaches you to try to be in the moment - and the truth is: Most of the moments of our lives are pretty damn good! Especially in first-world countries, 90+% of the time, we're warm, clothed, adequately fed, in a comfortable environment, and nobody's screaming at us and nothing's trying kill us.
So mindfulness practices help you take that 10% of your mind that's fretting about all that other stuff, and cranking out stress hormones and muscle tension, and quiet it down. You ignore the war in Whereveristan for the moment - which is good because you can't do a thing about it while you're at work - and look around and think, "I have a hot cup of coffee, a comfortable chair, the temperature's nice, and I have some code to work on. This is really pretty great!"
You take better care of yourself
A friend of mine who does a lot of physical work wanted to know about mindfulness, so we did what's called a "body scan", where you concentrate on feeling each individual part of your body, a few seconds at a time.
I first asked how he was feeling, and he said, "Fine." So we started, and in about twenty seconds, he was yelling, "OW! OW! My legs! My knees! Man, this really sucks! It makes me hurt all over! Why the hell does anybody do this?"
Of course, it wasn't the body scan that made him hurt. He was already hurting all over - he just had been ignoring it for so long he didn't notice it. After he'd done mindfulness practices a little while, he learned to be more careful about what he did, he figured out better ways to do his work that didn't hurt him so much, and it was amazing how much better he felt about life in general.
It can be the same thing with non-physical things. Let's say your boss is a jerk but it's gone on so long you ignore it. Then you become mindful, and say, "Hey, wait, my boss is a jerk." So then you deal with it somehow (talk to him, change jobs, etc.) and then you're happier. Or at least you make a conscious decision to not deal with it, so you don't stress about it subconsciously.
You enjoy life more
Let's say you're eating some delicious cake. The two ends of the mindfulness spectrum are:
- Wow, what a great piece of cake! This tastes so good. I'm really enjoying this!
- I wonder what's on TV tonight. Probably nothing good - maybe I should rent a movie. If I rented a movie, what would I rent? Hmmm. I think I'd like a comedy. Hey, where'd my piece of cake go? I wonder if it was any good.
You learn more about yourself: what you are and aren't good at, what you do and don't like
Some folks describe mindfulness meditation as "going for a swim in the sea of me." I've discovered two things about myself and programming, in part because mindfulness practices have led me to pay more attention:
- I love writing graphics code in C and C++. I'm really good at it, it exercises a lot of my talents like mathematics, and I enjoy writing the code and watching the result on the screen.
- I hate developing web sites. While I love the result, and respect people who are good at it, it just ain't me.
Guess which one I'm concentrating my programming career on?