One thing that I have heard often in practices of Mindfulness (and Buddhism) is that desire and attachment are the causes of suffering. And that all seems well and good (surely if you don't desire anything then it stands to reason that you won't suffer in wanting anything. Problem solved! Yay humanity!) But I think there's a little more to it that can become part of the practice of developers.
Too often I have sat frustrated in front of a piece of code because one of the following things happened:
- It didn't behave like I wanted it to behave
- It wasn't as simple as I thought it would be
- The code became much uglier than I wanted it to be
- The problem eluded me longer than I wanted it to take
- It wasn't as fun as I had hoped it would be
All of these problems aren't the code's fault. Nothing about the code or the computer could care less about how I feel about it. What I brought to the session were my desires of how it would turn out. My wants precluded me seeing things for how they were and taking them at face value in that moment. My frustrations arose from wanting things to be different and realizing that no matter how hard I tried, or how much I begged, the session was going to do what it would.
Getting mad at the computer wasn't going to make the bugs pop out quicker. Feeling pressured by the deadline wasn't going to make my mind think any clearer about the problem at hand. Fretting that the code that I was generating wasn't the most beautiful code I'd ever written wasn't going to make the code any better. What I brought to the whole exercise was how I wanted things to be and when those didn't happen I suffered for it.
I've been working on recognizing this tendency in my work. Rather than bring my expectations for how easy or quick or unbelievably awesome something will be I choose instead to agree that I will work on whatever it is that I'm working on and see where it leads. Rather than bring my preconceptions for how things will be I instead see how it is and work from there.
It's not easy. There's still times where I bring my old habits of frustration and anger to bear. But I've noticed that when I act with more curiosity that things tend to work out better.
There is still the intention of getting work done as well. It's not just unfocused sessions of sitting in front of the keyboard hoping that I'll write something amazing. I still have to understand what it is that I'm working on. But it happens on a more gradual scale and is driven by curiosity of how things will play out.