Improving Tech with Compassionate Code

Comments 0

Share to social media

“Compassionate Coding” is a term coined by April Wensel and a matter close to my heart since I learned about it a bit more than a year ago. If you need more information, check her website and follow her on Twitter. She’s the real expert and is available for workshops and talks.

So, why compassionate coding? What is it all about?

Suffering in Tech

There is a lot of suffering, especially in the tech industry, but also caused by the tech industry. We can witness this suffering on several levels every day:

One of the most prominent recent examples of suffering caused by tech is probably Facebook and its immoral treatment of private data, like using phone numbers which were meant for two-factor authentication to target ads.

Speaking of social media, studies show that the use of social media and, most likely, its optimization to keep people’s attention leads to an increased acceptance of racist and other extreme views. One study even suggests a link between the use of social media and hate crime against minorities, in this case, refugees in Germany.

While the rise of AI is surely a huge success for the tech industry, its products like autonomously driving trucks put whole communities at risk and we mostly lack appropriate answers to the “disruption” our technology creates. And who isn’t concerned about their smartphone listening in on conversations?

Suffering exists on other levels, too, even on a very personal level. Think of the language we often use in our job:

  • Luser
  • RTFM!
  • Too stupid to use it
  • If you don’t get this, you have no business in coding
  • This codebase is a nightmare
  • PEBKAC (Problem Exists Between Keyboard And Chair)

I could continue the list endlessly. There are dozens of examples for suffering in tech, even to the point where the term “nerd” is used to describe the stereotype of an unempathetic jerk.

What is Compassion?

How does this relate to compassionate coding? What does compassion have to do with suffering? What is compassion?

The feeling that arises when you are confronted with another’s suffering
and feel motivated to relieve that suffering.

 

This is the definition of compassion by Berkeley (via April Wensel). In short, compassion is about reducing suffering, and compassionate coding is about reducing suffering in tech

This definition shows that compassion consists of two aspects:

To see or notice suffering – “are confronted” –  and to take action to change it – “feel motivated to relieve”.

I love how this first aspect embraces a mentality of curiosity, of constant learning and exploration, something we developers are pretty used to. We love exploring things; we are used to constantly learning and increase our knowledge about a variety of topics.

To see and be confronted with another’s suffering requires us to learn to notice suffering first. This often means walking in each other’s shoes; it means to develop a sense for how other people feel and experience situations. It also means to understand why we feel the way we do.

After being confronted, compassion wants to take action – this is again very natural to developers from my experience.

Some examples:

  • I see the suffering of new colleagues when they need to understand my code and take action by documenting it.
  • I see the suffering of people who have to maintain my code – which can also be my future self – and take action by applying good coding practices and simple design.
  • I see the suffering of my customer when facing bugs in my software and take action by establishing automated self-tests. (Oh yes, testing is compassionate!)

One step further:

  • I see and understand the underlying suffering of that specific request of my customer, which helps me to take the right action and develop a fitting solution.

Where to Begin with Compassionate Coding?

I wanted to change the world. But I have found that the only thing
one can be sure of changing is oneself.

Aldous Huxley

 

It all starts with us, with practicing self-compassion.

There are many situations which can cause suffering in ourselves. Let’s assume we made a mistake and are now beating ourselves up, often using a language which is very judgmental and overall negative. “I’m so stupid, what was I thinking when I wrote that? This is incredibly crappy code.”

I don’t know how many of you know the prime directive of the agile retrospective (via April Wensel). For those who don’t, it reads quite interesting

Regardless of what we discover, we understand and truly believe that everyone did the best job they could, given what they knew at the time, their skills and abilities, the resources available, and the situation at hand.

This directive contains some very significant aspects:

  • It assumes positive intent.
  • It accepts failure as part of an ongoing journey and assumes growth and change
  • It defines very clear boundaries because it acknowledges that there are things which are not under our control like the resources available or the situation at hand.

Boundaries

Let’s look at this specific aspect of boundaries because it is – in my opinion – a very crucial and not so obvious part of compassion.

Boundaries define our fields of responsibility. Like a fence around a garden, they define what we own, what we are responsible for, and what we are not responsible for. We are responsible for what we can control.

In order to become self-compassionate, we first need to clarify what is inside and outside of our boundaries:

Can we control the situation at hand? Can we control the resources – do we own them? Maybe.

But do you know what we have absolutely no control over?

Past events and actions!

They are completely out of our control; we can’t change them, and the agile prime directive embraces this fact very nicely. The past is not inside our boundaries; we can’t change it.

This does not mean that we are not responsible for the consequences of our actions, but it helps us to clarify our possibilities. What is inside our boundaries are the steps we take from the things that happened. We can own up to those actions and take over control. Understanding our boundaries can be exceptionally relieving and is also very effective because it helps us to focus on the things we can control and change. When we embrace this mindset, the language in which we talk to ourselves will probably change from a judgmental to an observational tone.

Yes, we did the best we could, given the circumstances. How can we improve the situation so we can act differently in the future? What additional resources can be acquired? How can we improve our knowledge or skills? Which things are inside our boundaries and can be changed? Where can we ask for help when something is not inside our boundaries?

Compassion Towards Others

Let’s try to adapt the principles of compassion to others:

I recently had a challenging situation when Pavel, whom I like very much – and don’t worry, I asked for his permission to share this example – one of the main contributors of utPLSQL version 3, became active again after a break and wanted to contribute to the java-api.

Since I took over responsibility for the java-api a year ago, I’ve spent a lot of my free time adding new features and refactoring parts of the code.

Pavel’s suggestion was something along the lines of “The current Java-API contains several code-smells, and we should rework the whole thing.”

This did something to me. I felt a massive amount of anger and was unwilling to accept any suggestions at this point. I had the immense urge to go all in and justify everything I had done, and push back on where he had been during the last year – you probably get it.

The question is: why?

He didn’t offend me personally or my work specifically, but he wasn’t very compassionate.

I guess most of us used the term “code-smell” in some form or other. I certainly did and was convinced to be very objective and professional by using it. But if we look closely, “code-smell” is not objective at all without additional context – it is not even clear. It’s a judgment, not an observation and most humans don’t react very well to judgments

Consider this alternative: “If we make sure these classes are immutable, we can reduce the risk of unexpected change of state. I also have some ideas about how we could change the architecture to increase the usability of the public API.”

I am pretty sure this wouldn’t have triggered the same reaction.

“But Samuel, you are so sensitive! You are so easily offended…

…learn to handle radical and critical feedback!”

This might be true. The thing is: it doesn’t matter.

Whether or not I am overly sensitive does not matter, it doesn’t change the way I feel. Other people might experience things differently, react differently, but that has no impact on my feelings in this situation. This is especially true in situations in which we feel attacked, where our analytical thinking is naturally oppressed.

How others take our feedback is nothing we can control. If we upset someone, we do so, no matter if we are right or if we intended to upset someone, or if we think our counterpart is acting overly sensitive.

If we choose not to be compassionate, we must be aware that we are often actively lowering our chances to get what we want. Compassion and kindness do not only reduce suffering, but they also boost the likeliness to get what we want

So, can we agree that it was all Pavel’s fault that I got angry, and it’s obvious that utPLSQL’s java-api will never get a change anymore?

Let’s talk about boundaries again.

Are my feelings inside Pavel’s boundaries? They are not. They are inside my boundaries. I am responsible for my anger. What’s not inside my boundaries are other people. We can’t control other people, and we can’t choose that other people treat us the way we want. But we can choose how to react and what actions to take.

I have to admit that I’m not very good at understanding my feelings and keeping calm and reflected. Being in an asynchronous conversation helped me immensely to deal with this situation because I had time.

I found out that the thing that mainly caused my anger was not the “code-smell” but the suggestion that “we” should “rewrite the whole thing”. I noticed that I felt that my boundaries of the time I am willing to invest had been violated.

My answer – due to the extra time I could take – was something like this: “I appreciate your motivation to contribute. However, I think I don’t get your vision, but I’m looking forward to seeing your implementation of the changes you have in mind.”

After understanding the cause of my suffering, I could set boundaries in a way that made it clear I wouldn’t invest my time into Pavel’s ideas as long as I couldn’t share his vision.

Saying “No”

We often think that compassion and kindness equal saying yes to everything. But that’s not true:

Compassion means to say “No” if we can’t say “Yes” without resentment.

Does this sound egoistic? Think about it this way:

There is so much relief when you can be sure that the person you ask for something will help you freely and without resentment, without attached debt, out of pity or in a condescending way – or just honestly say “No” or “Not now”!

That’s also the reason why being compassionate is not being fake-nice. Fake-nice can’t say no, compassion can. But it does so in a way which minimizes suffering.

What They Want to Forbid

When I told my best friend about that idea of compassionate coding and passed him an article by April about why it’s time to retire RTFM (a great article, I highly recommend it) his reaction was like “Look! They want to forbid us from using RFTM, too! That’s so social justice warrior!”

I can see the suffering behind his fear; no one wants to give up on things that they’re used to, and we are also very likely to repeat what we experienced ourselves. But the article doesn’t forbid anything; it just explains why the use of RTFM is probably harmful to all participants and that there are more effective alternatives to achieve the goals you usually want to achieve by using “RTFM”.

The truth is: compassionate coding won’t forbid anything, because it won’t force an opinion upon you. It’s not a political agenda, it’s not about judgment and “you are wrong”. It’s actually the opposite of dogma.

Compassionate coding might, however, educate you to notice things you did not notice in the past. It might eventually show you how some of your actions cause suffering for others or yourself. And it will be honest about that. It might even start to change you. Which can be very scary

Empathy and compassion can be grown by practice.

Maybe, by practicing, we will begin to care for things which were not in our focus before. Maybe we will be able to make a difference so people who gave birth to a stillborn will not receive pregnancy ads. Maybe we will be able to improve the help that suffering people get from our apps. Maybe our ability to see the suffering of the world around us will encourage us to invest our energy into projects like FABE

Compassionate coding can be dangerous and scary because it can widen our horizon and raise the urge to take action.

But I want to encourage you: Compassionate coding is not about being perfect. Otherwise, I would’ve given up already. It is about trying and learning, about change and curiosity.

If I caught your interest, I would love to connect with you and share experiences or leave a comment here.

Let’s make tech more compassionate!

This article was originally published at Clean Database Development.

Improving Tech with Compassionate Code

Load comments

About the author

Samuel Nitsche

See Profile

Samuel Nitsche is a curiosity-driven software developer who programs, learns and collaborates in the software trade since the early 2000s. He works as Senior Software Developer and trainer at Smart Enterprise Solutions. His main interest is on modern database development, automated testing and code quality, topics he writes regularly about on different platforms, mainly on his blog at developer-sam.de. He is an Oracle ACE, one of the main contributors and maintainers of utPLSQL and loves to share his experience in an entertaining way - gladly in Sith robes - at meetups and conferences.