Empathy When Reading Others’ Code

Many times, I’ve read through someone else’s code while raging internally. There are also plenty of times where I was reading code and having mean thoughts before I realized the code was my own. I realized I wouldn’t want anyone voicing these thoughts about my code. This led me to start making an attempt to incorporate empathy into my work. Software developers can apply empathy in many ways. But I’m going to focus on utilizing empathy when reading others’ code.

So, what does applying empathy while reading others’ code look like? It doesn’t mean you need to hide your opinions on how you think something is implemented. It also doesn’t mean avoiding making comments on a pull request out of fear of hurting someone’s feelings. Just because you empathize with someone doesn’t mean you can’t disagree with them or suggest a change. It means trying to make an honest effort in understanding the original author, being nonjudgmental of their actions, and thinking about how comments will be received.

Understanding

One of my favorite things about software development is that there are many ways to implement a solution. This means not everyone will think about or solve a problem the same way you would. The benefit of understanding someone’s perspective on a problem is twofold. First, by taking time to understand the other developer’s thinking, you will have an easier time understanding their code. Second, understanding different perspectives is an opportunity to learn different or better ways of solving problems.

Reserving Judgement

Understanding the author of the code you’re reading also involves recognizing that development isn’t done in a vacuum. There are deadlines, lack of experience, changing requirements, and many other things that can cause code to be substandard. Judging someone for that isn’t fair since you will probably be in a situation that would cause you to do the same. Trying to understand that can help ease the pain of reading through code that you would have written differently, because, odds are, if you were in a similar situation, you would have done the same.

Communicating Thoughtfully

There will be times when it will be difficult to understand the author’s intent. There will also be times where you disagree with the author. Even if you are curious or have a better way of doing something, communicating that without coming across as abrasive can be difficult. Taking time to be thoughtful about how a question or suggestion will be received will benefit the outcome of communicating your thoughts.

While I still have a lot to improve on, incorporating empathy into my work has helped me in many ways. I’m less angry when reading through code. It’s easier for me to navigate through solutions that are done with a different lens. And, I’m able to effectively communicate my thoughts.

If you’d like to do more learning on empathy, here are a few links that helped inspire this blog post: