Learn Why They Are Doing It

2020, Jul 04

It is often easy to get frustrated when another person says or does something that seems abnormal to you. No, not in the “supernatural” sense, though it would definitely get me concerned, but rather when their behavior seems completely illogical to you.

The problem is that if they’re doing it, it seems logical to them. They either have a good reason to do it, or don’t know of another, or better way to do it.

I sometimes catch myself reading someone else’s piece of code and getting frustrated because they’ve done it a certain way that I don’t like. But if instead of immediately jumping to conclusions about the person and their ability to code, I find that some of the following reasons may apply:

1. The feature of the language that you would use to accomplish the same task just didn’t exist when that code was written. There are plenty of examples of this I can find in our C# codebase at work, anything from string interpolation to async/await statements.

2. They don’t know any better. Nobody has ever told them that their way is not the most performant or readable, so you can’t blame them for not knowing it. There are plenty of things that you do just because it’s the only way that you are aware of. That’s why code reviews are important. You could argue that they should be progressing by reading books or blogs, reading other people’s code, and taking extra courses, but let’s be realistic. If you look at any job posting, the number of technologies required for you to know easily averages 15+. So if I am learning something, it’s less likely I will ever be an expert in it unless that particular technology is what I work with most of my workweek.

3. The way you think it should have been written is too complicated to understand. Yes, this is actually on you. A lot of times, it is okay to give up some performance improvements (not always) in exchange for readability. Especially on a team with a lot of junior developers.

4. You’ve actually written that piece of code two years ago and hopefully, now you’re a more skilled developer than you were then, so that old piece of code may seem like it wasn’t the best approach.

5. You’re very opinionated and their solution is no better or worse than yours. It’s just a matter of preference.

I could probably come up with a number of other reasons. Someone was tired, or had to work overnight to meet a tight deadline, or implemented a naive solution to see if it will work and forgot to go back to fix it. Reasons can be many, and it’s important to figure out the logic behind them, instead of immediately starting to judge.

The “learn why they are doing it” rule also applies to more general things outside of coding. Someone leaves work ten minutes early every day? Maybe instead of starting to gossip about their behavior, it’s better to approach them and find out the reason they’re doing it. It’s very likely their reason would be pretty valid (e.g. to pick the child from school). And yes, you still may not approve of that behavior, but at least knowing their “why” will give you a different perspective.

I am by no means an example of a “good guy”. It is very hard for me not to judge people, but then I remember that one day I was just learning how to code and probably contributed a lot of terrible things to the codebase. Well, maybe not terrible but the ones that could have been done better. I also needed to take off time to take care of personal issues several times during my career. We’re all different and have our own sets of problems. The only thing that makes us alike - the fact that we all have problems.

Also, and it may be hard to admit, but the solutions we have in our head may not be that optimal as well. There are always going to be people who are smarter than us and who can do a better job than we do. It’s important to understand that and make sure that if you somehow figured that you’re smarter than someone, instead of judging them, you need to learn why they’re doing it and offer to help.

If all of us started to do it, then life would be a lot better and people wouldn’t refrain from asking questions on Stackoverflow.com because they wouldn’t want to be considered stupid or even get harassed by the “geniuses”.

How often do you find judging others?

Subscribe for more!