Tuesday, July 23, 2019

Software reviews: Why rework needs to be reviewed and extra rework requested if necessary

Some years back, when I started reviewing code, sometimes a colleague would write a rather ambiguous comment in their code, and I would request that they update it to a clearer one. However, sometimes the comment remained just as unclear after they had reworked it. I would give up and just let them go ahead and integrate their code, feeling embarrassed about being seen as nitpicky if I asked them to rewrite the comment.

However, as time went by, I realized that this was an inappropriate and unprofessional behaviour. Let's take a look at why.

When you comment on a colleague's code and ask them to change something, it should be because the code would be improved after the change. So if you accept a rework, it should be because the code is acceptable after the rework. If the code is still unacceptable after the rework, what would be your reasons for accepting it? Is it because (a) the person has spent time on it? Is it because (b) the person has already done something upon your request? Is it because (c) the person has already done multiple reworks?

If your reason were (a), it would imply that you commented on your colleague's code just so they would spend more time on their task. If your reason were (b), it would imply that you just wanted to make sure they did something extra upon your request (way to show power!). If your reason were (c), it would imply that you just wanted to make your colleague do a certain number of reworks. In all these cases, if your initial purpose for commenting was to improve the code, your purpose would not have been fulfilled and you might as well have not asked for any rework in the first place.

Therefore, if you feel that a colleague's work needs improvement and you tell them so, the right thing to do would be to actually make sure that their rework actually does improve the code. Otherwise you would be making them do extra work just for the sake of doing extra work. After that extra work, they would not have improved their code, nor would they have learned something new (since they had not understood the improvement that you had requested). In the terms of Radical Candor (just Google to find out what it means), your behaviour would fall under the category of "ruinous empathy" (or "obnoxious aggression" if your initial purpose of commenting was to give your colleague extra work...but let's assume that is not the case!).

No comments:

Post a Comment