← Back to home

Making changes to others' code

In a company of a friend, it’s usually better to listen more and talk less. The same I’ve noticed around the code: when trying to fix or improve someone else’s code, it’s better to read more and write less.

Most of the times I find that the less the changes I introduce to fix a bug, the more I understand and know the codebase. Understanding and knowing are different: knowing means you’ve read the codebase in breadth and you roughly remember the modules’ contents; understanding is when you know how modules work and why they are built in a certain way.

Introducing too many changes to fix or improve the code that someone else has written (even in a separate module), is often similar to disregarding that person’s opinion in a patronizing way. Making small changes is similar to either agreeing with the speaker and adding another related short idea on top of what they’ve just said, or making a short polite correction to their speech.

Code authors might be secure and confident in themselves, so rewriting their code might not be perceived as an insult. However rewriting ideas and past learnings doesn’t seen to be welcomed ever. Rightfully so. Ideas need to be defended and compared, and an implemented idea is usually better than the one that needs to be implemented. Rewriting past learnings is most of the times foolish, and if undertaken then should be done very carefully and tested thoroughly before shipping.

It’s always better to talk to the author before making changes to their code.

Last edited on Apr 20, 2019