Empathy

Programming Empathy: Emotional State Machines

Programming Empathy: Emotional State Machines

by Coraline Ada Ehmke

In her presentation at RailsConf 2019, titled "Programming Empathy: Emotional State Machines," Coraline Ada Ehmke emphasizes the importance of emotional intelligence and empathy in software development. Ehmke challenges the traditional technical focus of the engineering community by advocating for the integration of emotional awareness into programming practices.

Key points discussed include:

- Definition of Emotional Intelligence: Emotional intelligence involves recognizing emotions in ourselves and others and using that understanding to guide our interactions.

- The Emotional Spectrum: Ehmke presents the idea that empathy exists on a spectrum ranging from apathy to true empathy, and emphasizes the negative implications of disregarding emotions in favor of logic.

- Common Pitfalls:

- Narcissism: Prioritizing one’s own feelings over others can lead to misunderstandings and a lack of connection.

- Apathy: Failing to empathize with others' struggles can result in detrimental impacts on teams and communities, including creating software that does not reflect the needs of a diverse user base.

- Codependence: Sacrificing personal needs for others can also hinder team dynamics and personal well-being.

- Models of Emotional Experience: Ehmke outlines the phases of emotional experience, which include a trigger, emotional state, reaction, decision, and outcome. She links this process to state machines, common in programming, to illustrate how emotions can be understood and managed systematically.

- Personal Anecdotes: Ehmke shares her own experiences with emotions such as anger, guilt, fear, anxiety, and sadness, weaving these personal stories into the broader theme of the talk.

- Practical Applications of Empathy: The talk concludes with Ehmke urging attendees to embrace their emotions, practice emotional intelligence, and apply empathy not only to their work but also within their interactions in life and community.

Overall, the talk showcases that enhancing emotional intelligence is not merely a soft skill but a necessary component of becoming effective developers, ultimately leading to improved teamwork and software quality. As Ehmke articulates, true empathy represents a vital tool for connecting with others and enhancing user experience in software development.

00:00:20.599 Hi everybody. Because I'm going to forget at the end of the talk, I have some amazing stickers, and I love to meet people. I have "Code Which" stickers, "Compassionate" clear stickers, and "Greater Than Code" stickers. Please come up to me, introduce yourself, and get a sticker. Content warning: this talk contains mentions of suicide and hospitalization, as well as some transphobic and racist slurs.
00:00:42.120 My name is Coraline Ada Ehmke. You can find me on Twitter at @CoralineAda. You can also read my blog and find out where I'm speaking and other projects. My open-source project is "Code With"—which is probably the best vanity URL ever. I am currently a principal engineer at Citrix and I am most well-known as the author of the Contributor Covenant, which is the first and most popular open-source code of conduct in the world, with over 100,000 adoptions, including Rails, Linux, and the entire open-source portfolio of Apple, Google, Microsoft, Intel, and Salesforce. I'm co-authoring a book with my friend Naomi Freeman called "The Compassionate Coder," which is about the practice of empathy in software development.
00:01:05.880 If I'm successful, you're going to walk out of this talk with new tools to develop your emotional intelligence and inspiration to improve the practice of empathy in your daily life. So to begin, let's define our terms. What is emotional intelligence? As programmers, there are certain things we consider baseline requirements for technical excellence. We place a lot of value on problem-solving, and we like to think we approach problems as scientists, experimenting with different solutions until we find the right one. Tremendous effort has gone into improving tools for perfecting our code, from better compilers to testing frameworks, pair programming, TDD, CI/CD. When we solve a tough problem, we love to share our success with our peers.
00:02:02.520 We tweet about it, blog about it, and give talks about it. We celebrate our problem-solving skills; our ability to overcome difficult technical challenges is how we measure our success. It impacts our self-image as engineers, and we reward good problem solvers with raises, promotions, merit, and sometimes even fame. But not every problem relates to code. There are serious challenges we encounter outside the codebase: problems with team members, our boss, loved ones, or issues with how we react to others—or how they react to us. Problems with our self-image, self-confidence, and emotions can feel overwhelming. This is where emotional intelligence comes into play.
00:03:00.830 Emotional intelligence is about our ability to identify emotions that we are experiencing and using our understanding of those emotions to guide how we act and react. The idea of quantifying emotional intelligence is a subject of hot debate in academic circles. Some psychologists believe it is an innate ability, while others see it as an emergent social phenomenon. However, discussions on whether it can or cannot be measured are beside the point. Emotional intelligence is something we can recognize in ourselves and others in our daily lives, and that cannot be disputed. Without awareness of how emotions affect us and others, we may blunder through life, leaving confusion and hurt feelings in our wake. But it doesn't have to be that way. The good news is that emotional intelligence is something we can improve with practice, but the bad news is that practice is a lot of work.
00:04:19.840 Interacting with other people can be messy and confusing. They have thoughts, feelings, and motivations that we can't always see, and they react in ways that sometimes feel irrational to us. We're often left in the awkward position of trying to understand them, to help them, or at least not to make them feel worse. Since we value problem-solving, when faced with someone experiencing strong emotions, it's tempting to put on our problem-solving hats and try to fix what's wrong. "You're having a bad day? Let me take a look at that bug you've been wrestling with." "Your boss is being a jerk again? Let me help you fix up your resume." Our hearts may be in the right place, but reacting to their emotions by trying to solve a problem may mean ignoring how the other person is feeling. If they're frustrated, maybe they just need to vent. If they're angry, perhaps they just need validation. If they're upset, maybe they just want someone to listen to them and really hear them.
00:05:21.030 Emotions are not problems to be solved. If we insist on applying logic and rationality and place them above basic emotional intelligence, we run the risk of making a bad situation worse. When we value problem-solving over empathy, we can cause real harm to those around us. Emotions are complicated; they are not something we can solve with a simple algorithm. Thus, emotional intelligence is about recognizing emotions in ourselves and in others. It's about opening ourselves up to what other people are feeling. If we ignore their feelings, we place ourselves at odds with their well-being. As an industry, we cannot continue to forgive a lack of social skills simply for technical merit. We need to do better; we must learn to approach our work and our relationships with empathy.
00:06:05.480 But empathy is often misunderstood. Sometimes we think we're being empathetic when we're really not. In our book "The Compassionate Coder," we define the practice of empathy as a spectrum that represents the dynamics between the self and the other. At the most extreme end of the empathy spectrum is apathy, but even apathy isn’t a complete lack of empathy; it's empathy that's held in reserve for an in-group. A study at a Chinese university a few years ago exposed students to images of people in painful situations. The students' empathy response was measurable using imaging technology; it was found that they reacted with a stronger emotional reaction to images of Chinese individuals in painful situations compared to images of white or black individuals in similar situations.
00:07:04.540 However, when the study was repeated in the United States with Chinese American students, the empathy response was more balanced across the groups. This illustrates that we tend to reserve empathy for our in-group. Conservatives in this country often see immigrants, people of color, queer individuals, trans people, and the poor as 'the other' and only extend empathy towards people who look like them—white, male, privileged, heterosexual individuals. That lack of empathy for the other also happens within technology communities too. Many developers like to bash languages like JavaScript and PHP with a contempt culture, raising a critical question: when we criticize another language, what are we really criticizing? Our criticism impacts those individuals who work with those languages daily, those who enjoy them and produce working software in those ecosystems.
00:08:11.420 It's no coincidence that these communities have a higher proportion of self-taught individuals and a greater representation of women and minorities. The contempt we express for these so-called inferior languages manifests as contempt for people who are not like us. It doesn't matter if it's intentional or not; it doesn't matter if we are trying to harm those individuals—in the end, it's the impact of our words that matters. Apathy, the lack of empathy for others, can also be seen in software development itself. If we attempt to cater to a user base that doesn’t reflect our actual users, we end up building features nobody wants, omitting features that could better serve a significant portion of our user base.
00:09:30.300 Consider Slack. Slack has over 10 million daily users, with 70% using the free tier. But what has Slack done for free-tier users? They killed Screenhero, a tool that many people in open-source and mentorship contexts used, which is now only available on paid accounts. They've also killed the IRC gateway, which was a way for many individuals with disabilities to access Slack communities. There is a lack of blocking functionality and meeting capabilities, indicating that Slack refuses to prioritize the needs of users who rely on the platform for community organizing, open source, and peer support. That is apathy.
00:10:08.970 Next on the spectrum is narcissism, which involves placing yourself above others. Narcissism can be just as damaging as apathy because, in both cases, it emphasizes the boundary between yourself and others. Sometimes, when we think we are practicing empathy, we are actually demonstrating our own privilege. For example, when discussions arise about the significant pay disparity between white women and black women, someone might respond by saying, "I guess I’m very privileged as a white woman." In doing so, they are centering their privilege and making it about themselves rather than truly listening to the experiences of others.
00:10:53.499 Twitter provides a relevant example of narcissism in software. Twitter treats its users as commodities, focusing on monetization strategies and an advertising-based model that emphasizes user engagement—following, liking, retweeting, and integrating users' content into their advertising algorithms to deliver relevant ads. Engagement metrics take precedence over user safety; thus, the platform tolerates harmful content, prioritizing engagement over user well-being. User safety often falls by the wayside when companies pursue monetization at any cost.
00:11:53.500 The next category on the spectrum is codependence. The idea of codependence might sound like a personal weakness, but that isn't the case; it takes enormous strength to prioritize someone else's needs over your own. It's much harder to forgive someone than to hold them accountable. Taking on the problems of others, self-identifying as a hero, and overestimating your own strength leads to exhaustion and hinders your ability to relate well to others, forming unhealthy relationships and weak teams. If you allow others to eclipse your own feelings and needs entirely, you lose your own self.
00:12:26.350 A perfect example of codependence in software is Uber, which prioritizes customer satisfaction over its own needs. It has been reported that Uber might never turn a profit due to the working conditions and low wages for its drivers, not to mention its famously hostile culture toward its employees, particularly women. True empathy is the practice of seeking genuine, honest connections with others. Some people claim that they don’t have the “spoons” for empathy. If you're unfamiliar, 'spoons' comes from the disability community and illustrates how everyone has a limited amount of energy in a day. People who are neurotypical or not disabled typically have more 'spoons' of energy compared to those with disabilities or mental illnesses.
00:13:17.800 For many people, even normal tasks can take more energy or 'spoons'. However, I don’t believe the spoon theory applies to empathy. Empathy isn’t a zero-sum game; if done correctly, it should be an exchange of energy—not a drain. We shouldn’t reserve empathy solely for those we think are deserving. That sort of moral calculus leads to apathy. A company that embodies true empathy is Basecamp. They run a profitable business and created Ruby on Rails, one of the most robust and accessible web application frameworks, which they generously gave away for free. Open source at its best exemplifies empathy—expanding the definition of the self to include users who might otherwise be considered 'the other.' If designed correctly, open source meets everyone's needs, and ultimately everyone wins.
00:14:41.000 Emotions can seem primal. When we experience an emotion, there are five distinct phases we cycle through. Step one is the trigger; every emotion arises due to an event, either internal or external. Step two is the experience; we find ourselves in an emotional state, which can emerge unexpectedly and feel overwhelming. It can haunt us for hours, days, or even weeks and can trigger memories—sometimes painful memories—of the last time we felt that emotion. It steals our attention, becoming the most important thing in our minds. Step three is the reaction, which can be conscious or subconscious; we might have a physical response like a racing heart, tears, or a smile. These reactions often feel automatic.
00:15:40.690 Step four is the decision: the choice between taking action or not. Often we don’t recognize this step; we may overlook it because we are so overwhelmed. But even in a subconscious reaction to an emotion, we can decide how to process it. We can ask ourselves: how do I want to react? Will I passively let this emotion overtake me, or will I actively engage with it? How can I connect the emotion I’m feeling with the person who triggered it? Is this an opportunity for open and honest exchange? Finally, step five is the outcome. If we passively experience an emotion and let the decision-making stage slip by, we might reach a state where the emotion lingers unprocessed or leads us into a cycle of negative feelings. On the other hand, if we consciously decide how to deal with our emotions, we are more likely to process them healthily and communicate with others about them, leading to a more positive outcome.
00:16:45.120 Imagine your brain as a train station. You're standing on the platform, and you have a destination in mind. A train pulls in—but it’s not the one you were expecting; that train represents an emotion. You can ignore it, suppress it, or pretend it’s not there. You can choose to get on and lose yourself, disregarding your destination, or you can choose to ride it for as long as is necessary and then get off where you want to be. In her book "The Art of Empathy," researcher Carla McLaren describes emotions as neurological programs requiring action. This metaphor resonates with me as a developer.
00:17:38.700 To take these ideas a step further, I have theorized that I could model emotional experiences as state machines, with each node reflecting a state of mind—like stages of processing one of the most powerful, and sometimes frightening, emotions: anger. In May of 2014, I had been married for 18 years. I realized 20 years prior that I was transgender, but at the start of my career and the beginning of building a new family, I didn’t think I could transition successfully. In 2014, my daughter was 17 years old, and we had a Mother’s Day tradition of visiting a fancy outdoor mall to buy gifts for my wife. This was an activity my daughter and I had shared for as long as she had been alive.
00:18:14.570 After my transition, when Mother’s Day approached, I asked my daughter what she wanted to do. She told me she wanted to celebrate both of her moms. This brought tears to my eyes. I suggested we keep our usual routine at the mall: she could buy my wife some presents, and I would expect my wife to do the same for me. That night, when I was getting ready for bed, my wife stormed into the bedroom and said, "No, no, no. You are not taking this away from me! You've taken enough from me!" She lashed out in anger.
00:19:09.560 She could not respect where I was in my life; she could not respect me as a woman, or as a mother to our daughter. Anger arises when a boundary or self-image is challenged. We often find ourselves overwhelmed by anger, and our subconscious reaction is to lash out. If I had responded in kind to my ex-wife, I would have allowed her narcissism to eclipse my self-worth. When we lash out in anger, it leads to resentment in ourselves and in others. A conscious reaction to anger would be to acknowledge it.
00:20:10.960 Sometimes acknowledging your anger can lead to a restoration that wouldn't otherwise be possible. In my case, though, this restoration was impossible because of the boundary she crossed; she was unwilling to acknowledge my feelings or my identity. Thus, I took action to restore my self-image: I am my daughter’s mom too. If my wife couldn’t accept this, it was time to leave.
00:21:03.080 In 1994, Bill Watterson in the complete "Calvin and Hobbes" wrote, "There’s no problem so awful that you can’t add some guilt to it and make it worse." In 1994, while living in Austin, Texas, I was hanging out at a diner with my friends. We all sat together each night, smoking cigarettes and drinking coffee. One friend, Trey, was a filmmaker, while another, Chris, was a writer. We had this fantastic idea of starting a company together, which we would call "The Devil's Workshop," and I would run a web design business called "Idle Hands Design." The devil finds work for idle hands, get it?
00:21:37.260 Chris's roommate, Mark, was essentially sponging off him and the rest of us. He had no job, no permanent residence, and no money for food. We all took care of him, and he promised us he would pay us back once he turned 25 and received access to his trust fund, which would mean he would never have to work again. On April Fool's Day in 1994, I had an idea. I called Trey and said, "Trey, it finally happened. Mark got access to his trust fund, and he's going to invest in the Devil's Workshop!" The excitement in Trey’s voice was palpable, as he started listing off all the equipment he was going to buy. He had this business plan worked out; he was truly enthusiastic about this positive news. I felt like the biggest jerk in the world when I said, "April Fool's!" He broke down in tears, hung up the phone, and we never spoke again.
00:22:30.220 I've never since played an April Fool's joke, realizing that I have difficulty distinguishing between cruelty and humor. Guilt is triggered when someone is hurt, and I realized that my words caused substantial pain for Trey. I felt overwhelmed by guilt and shame, but I reacted narcissistically by making it about how I was feeling. I couldn’t view how to remedy the hurt I caused; instead, I ended up living with that guilt. Our friendship ultimately ended, and we were both left hurt.
00:23:23.400 The empathetic reaction to guilt involves acknowledging the wrongness of our actions and working to balance our feelings of guilt with the feelings of those we've hurt. What if I had immediately taken accountability for my actions instead of remaining silent? Would I have had a chance to restore our trust? Perhaps I would have been saved twenty-five years of feeling guilty.
00:24:30.850 Lovecraft wrote that the oldest and strongest emotion of mankind is fear, and the deepest kind of fear is fear of the unknown. I had a very difficult childhood; my father was an alcoholic and abusive, while my mother was a drug addict and also abusive. As a restless sleeper, one night I rolled out of bed without waking up and ended up underneath it. When I finally woke, I had no idea where I was; it was pitch black, and I couldn't see my hands in front of my face. I tried to sit up and banged my head on something wooden, feeling certain I was in a coffin. I panicked, fearing I’d been buried alive.
00:25:39.850 I banged on what I believed was the coffin lid, crying out for my mom, but there was no one to reassure me that everything was okay, and I stayed that way until morning, when light began creeping in under the bed. Fear is triggered by a novel situation; my dark, constricted surroundings caused panic and a freeze response. I remained in panic mode for hours. What if I had calmly acknowledged my fear instead? What if I had said, "I’m afraid now, but maybe things aren't what they seem"? When we actively recognize our fear and make deliberate decisions, we can reorient ourselves.
00:26:45.550 On September 16th of last year, an upset surged through the Linux community after the adoption of the Contributor Covenant. There was fierce backlash from anti-CRC individuals, including women who experienced strong harassment. On December 6th, many of these individuals hijacked the linux.org domain and published personal details about me, including my Social Security number, my name change history, my address, and phone number. Anxiety is triggered by unexpected changes, and I felt completely overwhelmed, terrified, and paralyzed. It would have been easy to avoid action; if I had done nothing, I would have remained frozen and terrified indefinitely.
00:27:54.600 Instead, I chose to reach out for support. My friends helped me create a plan; I organized and acted. I strengthened my home security, updated my passwords, enabled two-factor authentication like I had meant to for ages, and froze my credit reports. I eventually felt safe again and prioritized remaining vigilant. My anxiety diminished as I took control; I turned anxiety into defiance.
00:29:08.190 In March of this year, a confusing situation arose when a feature I deployed in one of our systems malfunctioned in production. It became an emergency, and the entire team collaborated to rectify it. Confusion occurs due to unexpected changes, and in this case, something that once functioned properly had stopped working. It would have been all too easy to feel overwhelmed, complicating my thoughts. Would this malfunction lead to a reprimand? Would it put my promotion in jeopardy or cost me my job?
00:29:56.350 To combat this confusion, I first took a moment to cool my head. I stepped outside for a cigarette and thought about the problem before returning. Afterward, I drew diagrams to visualize possible causes, which aided collaboration among team members. Collaboration itself is an act of empathy. I shared the diagrams with affected teams, sparking a productive conversation that resulted in pinpointing the problem and formulating a plan for a fix in under thirty minutes.
00:30:55.530 Longfellow once said, "Everyone has their secret sorrows, which the world knows not." Early in 2016, I landed my dream job—joining GitHub's community and safety team as a senior engineer focused on anti-harassment and community management features. Everything flowed smoothly as I rolled out features aimed at keeping users safer from abuse and closing attack vectors. In July of the same year, after an annual performance review, my manager and I discussed a promotion I had hoped for, but to my surprise, my review was harsh.
00:31:53.580 My manager criticized my lack of empathy in communications, highlighting a conflict that arose between me and a data scientist who had asked a transphobic question on the open-source developer survey. I suffer from bipolar disorder, PTSD, and anxiety. My daughter also copes with OCD and anxiety disorders. We maintain a number of psychiatric medications at home. Following my bad review, I took an overdose in a moment of desperation. Realizing the physical effects of the overdose were taking hold, I panicked and contacted my psychiatrist. She instructed me to go to the hospital immediately.
00:32:47.230 After a few hours there with several doctors talking to me, I calmed down, but they still insisted on involuntarily committing me to a mental health facility for ten days—an experience I found incredibly distressing. When I finally left, my therapist advised me to go back to work and try to restore some semblance of normalcy. Upon returning, I was put on a performance plan and eventually fired for a lack of empathy.
00:33:38.090 Sadness is triggered when things don't meet our expectations. In my case, I felt that not being recognized for my work was akin to a betrayal. The sadness was overwhelming, as I couldn't let go of the belief that I had done good work while my managers viewed it as inadequate. Allowing their feelings to eclipse my self and self-identity led to depression—a depression that culminated in a suicide attempt and a brief hospitalization.
00:34:18.860 What if I had reassured myself that my management's assessment was incorrect? What if I had affirmed my belief that I had indeed been doing well, but acknowledged the irreconcilable differences between my manager and me? If I had, I might have felt more grounded, prompted to seek other job opportunities much sooner, and saved myself from the humiliation of being terminated.
00:35:35.700 Happiness can be described through the words of the poet Shelley: "I have drunk deep of joy and shall taste no other wine tonight." As I mentioned earlier, I realized I was transgender in my early twenties but waited almost twenty years to transition. On February 28, 2014, I gathered all my male clothing and placed it into trash bags, which I drove to Goodwill and donated. The next day, March 1st, 2014, Coraline was born.
00:36:05.150 Happiness is often stimulated by novel experiences—in this case, my full-time transition brought overwhelming joy. Our unconscious response may be to privatize this happiness. I could have easily kept my joy to myself and hidden away in my new life; while this wouldn’t have been a bad outcome, it wouldn’t have optimized the success of my transition. Instead, I chose differently. I decided to share my story and express my joy. I was enthusiastic and excited; I shared my experiences with everyone.
00:36:38.700 I tweeted about my day, I wrote and gave talks concerning my experiences at various conferences, and I recorded and posted videos on YouTube. Sharing my happiness enabled emotional connections and discussions with others who faced similar challenges. Each time I delivered that talk, someone in the audience would reach out and tell me I had inspired them to begin their own transition. That brings us to a conclusion.
00:37:18.165 Let's take a breath together. I would like to end with some reflections: where do you want to fall on the empathy spectrum? An apathetic developer creates apathetic software. If we lean into narcissism, we might only focus on solving problems that affect privileged individuals in San Francisco. If we devote ourselves to codependence, we risk working ourselves to death for people who don’t need it. Alternatively, we can choose to practice empathy. We can cultivate true connections with our code, our work, our peers, and our users. Emotions can be daunting; we might fear their implications, effect on our identity, and the reactions of others. We sometimes fabricate a false dichotomy between emotional expression and rational thought.