Code reviews are an essential part of the development process. They help us improve the quality of our code and catch mistakes that we may have missed somehow, even from just having looked at the code for so long.
Personalities and in particular,
ego, can be a hindrance to getting the most out of a code review. It's natural for programmers to become attached to their code. To a certain extent, some attachment to your work is fine. In fact, it's necessary. The pride we have in our work is a big part of how we make it better. However, we can't let our pride get in the way of making improvements. When we get attached to the code we write, we can become very protective of it. This can cause us to overlook some of the code's flaws, much like a mother whose baby only she can love. It can also make us very defensive and closed-minded, taking any criticism of flaws as personal attacks and insults, even when that was not the intent behind the critical comment.
Since I love babies in general, I'd like to stay away from that analogy. I'd rather use "much like a pig farmer, whose pigs only he or she can love" instead. This also leads to one of my favorite things to say to programmers about
code smells: "Don't be like a pig farmer who loves his/her pigs no matter how much they stink."
I have practiced
egoless programming for a while now and I think this has helped me tremendously in getting over my attachment to code that I write. I can be critical of my code's flaws without any qualms but more importantly, I am able to freely accept reasonable criticism of my code's flaws. I accept the fact that I can make mistakes, that I can come up with dumb designs and less-than-stellar implementations. Much like how warriors can go bravely into battle after having accepted that they are already dead, this kind of mindset frees me to refactor my code ruthlessly and relentlessly. I don't care that others might think I'm dumb; I know I'm not. I just care that the code gets better. The code is not
me and its flaws don't define me or my competence as a programmer.
As such, I'd like to propose a standard working agreement between everyone who participates in this Code Review forum. I would like for anyone who wishes to participate to agree to be guided by the precepts of
Egoless Programming in pursuit of the ideals of
Software Craftsmanship. If the latter is a bit much for you, then at least the former.
Can we all agree to this?
If you would, please respond to the following poll: