background

Code Reviews Are Like a Game of Uno

Playing Uno, the famous (or infamous) card game, is the easiest way to end a long and strong friendship. Everybody knows it. The moment your best buddy drops the nth '𝘱𝘭𝘶𝘴 4' card, and you're forced to draw n*4 cards, you both know the friendship has taken a hit. There's no way to recover; no specialist can save the relationship. Your friend has stabbed you in the back, and from that moment on, trust seems impossible.

Well, maybe it's not that tragic. Next round, you'll do the same to your friends, and balance will be restored.

It's the same feeling when my code is assigned to a colleague for a code review. That piece of software is something you deeply care about; it cost you sweat and tears. Only you know why that code smell exists or how many hours you spent working around that glitch in a third-party library. But the reviewer doesn't know.

He has a heart of stone, 𝗻𝗼 𝗳𝗲𝗲𝗹𝗶𝗻𝗴𝘀.

The next thing you know, after submitting your PR full of hope and happiness, comments start flooding your inbox: "You could have done it this way," "This looks fishy," "There's a cleaner way to do this," "This can be moved," "You can improve performance by 1 microsecond," and finally, "This stinks."

Just like in Uno, your fellow developer has betrayed you, disrespected you, and stabbed you in the back.

Every time this happens — and it happens every time I submit code — my first reaction is personal. "𝘏𝘰𝘸 𝘥𝘢𝘳𝘦 𝘺𝘰𝘶, 𝘴𝘮𝘢𝘳𝘵𝘺 𝘱𝘢𝘯𝘵𝘴?" I think. But when I stop to actually analyze the feedback and remove my personal feelings, I realize each comment has merit. Making the changes another experienced developer pointed out helps me produce better code, find cleaner solutions, and even learn something new.

At the end of the review process, after cycles of submitting, reviewing, and fixing, the final result is always much better. And I feel better knowing a talented developer took the time to check my work, reducing the chances of bugs or unnecessary complexity.

And of course, I always have the chance to play my 'plus 4' card next time I review his code.

#typescript #react ICFM AG