Our minds jump from past memory to future fantasy and are extraordinarily out of control. Buddhism provides a technique which helps us to tame our wild minds: meditation.
Meditation is sitting down quietly and being aware of all that goes on, without comment. In meditation (Vipassana) the idea is to stay with reality as it is experienced in this very moment. It brings about purification and insight.
I learned the technique of meditation at a 10-day retreat of dhamma.org. Last year I went to Thailand and I have lived 10 days in a similar manner as Buddhist monks and nuns at Wat Ram Poeng.
Blending in at a meditation retreat at Wat Ram Poeng
This has led to me appreciate this wonderful technique for feeling at ease and dealing with the vicissitudes of life.
Where meditation helps me to stay grounded, programming, on the other hand, can be an activity which moves me away from everyday reality. As a programmer I work with abstractions.
As Fred Brooks writes in The Mythical Man-Month:
The programmer, like the poet, works only slightly removed from pure thought-stuff. He builds castles in the air, from air, creating by exertion of the imagination.
Meditation can not only provide a welcome counterweight to this work with abstractions, it also cultives 10 qualities of character (Pali: paramis) that are useful during the practice of programming.
Below I will list these 10 qualities and explain how they might benefit the programmer.
Meditation teaches you to give freely without expecting anything in return. Won't be surprised when you start coding for others for the sheer joy of giving.
Meditation helps you to speak properly, perform good actions and have a right means of livelihood. Software engineering involves communication with others and is a way to sustain yourself. Cultivating the urgency to do or say the right thing will help you with this.
By renouncing the thoughts of for example sensual pleasures you become more adequate at dealing with that what is actually going on. When you code you code. Nothing else.
Meditation makes you realize on a fundamental level that everything is impermanent (Anicca) and that because we as human beings cling to and identify with (Anatta) this changing reality we suffer (Dukkha). One thing to learn from this is that you are not your code. This helps when receiving feedback.
Mindfulness trains the mind to not procrastinate. It leads to prolonged periods of focus. Focus comes in handy during programming.
Meditation gives you the patience and tolerance to just fill in that Excel sheet for the next hour.
You will tell your boss the true state of affairs: the software will not be finished before the deadline.
Just like the Buddha did not leave the tree till he was enlightened, you will not stand up from your chair till you have finished that piece of code.
Meditation teaches you to love what you do and the people you do it with. Enjoying what you do and cultivating good relationships with colleagues or friends helps with programming just as much as everything else.
Sitting through (enjoying even) hours of pain in your legs without responding to it has taught you to stay calm in the face of adversity. These 20 more use cases that you had initially overseen that will need to be implemented? No problem.
As a bonus, what I love of meditation is how aware you become of bodily sensations. For example: you notice earlier that your body is aching and that it is time to walk and stretch. It also helps with creativity. It's impressive how ideas start to flow when you watch your belly go up and down 30 minutes in the morning.
Interested? A good way to learn the technique of Vipassana meditation and experience its beneficial results is at a 10-day retreat at dhamma.org. Alternatively you can go to a country like Thailand and learn the technique at one of the meditation centers there.