This page shows the source for this entry, with WebCore formatting language tags and attributes highlighted.
Title
You're probably doing code reviews incorrectly
Description
The article <a href="https://www.stefanjudis.com/blog/processes-and-rules-make-code-review-less-intimidating/" author="Stefan Judis" source="">Processes and rules make code review less intimidating</a> writes,
<bq><img attachment="highlight_anything_you_think_seems_stupid.jpg" align="right"><b>Code reviews are, by nature, intimidating. Sometimes even brutal.</b> If you've been in the game for long enough, you probably experienced the following: you worked hard on a feature, you're proud of yourself and open the PR to be praised and land your changes, and then... it rains comments, suggestions and nitpicks. And if it's really bad, you're forced to take multiple feedback and clean-up rounds. It sucks.</bq>
Oh, wow.
Why are people treating writing code like individual school assignments?
That is absolutely not how to effectively use code reviews. That is absolutely not how to work in a team. Teams work together, not against each other.
Why are you putting your heart and soul into your solution? Why is it "your" solution? Is this how y'all were raised? You know, where you prefer being the star genius in your own story, where you managed to get the perfect solution on the first try? Like, you're the superhero, brilliant, engineer, billionaire playboy?
And then, you learn that you aren't, and you're shattered.
But you know what? You're on a team that's willing to look at what you made and really try to make it better. Maybe they will make it better! Or maybe they won't. Both are good! If they do ... then it's better. That's a win. If they don't, well, then, you've gotten some evidence that supports your theory that what you've written really is good and will work.
Up until someone looks at it, you only had a hypothesis that your solution was good enough. You suspected it because you had some code and you had some tests (yes you did, otherwise you have <i>no</i> right to be offended about code-review comments). That's a <i>hypothesis</i>.
You know who else does reviews to verify theories and hypotheses? <i>Scientists.</i>
Quit your whining. Quit your bullshit.
If you're treating code reviews like a gladiator arena, as if you were going on <i>Shark Tank</i> or <i>The Voice</i>, then <i>you're doing it wrong.</i>
The best software is written by a team. It is collaborative. Maybe one person is writing all of the actual text, but there are other <i>minds</i> that contribute advice and feedback that hones the final product.
You know what <i>that</i> sounds like? A writer and one or more editors or proofreaders.
This is how professionals work. Fix your process. Fix your expectations. Fix your fragile ego. Seek validation in a less self-destructive manner.
The author proposes a fix. It's a technical solution, so it's not great.
He could have suggested that people do "live reviews" instead of PRs because most people are too lazy or incapable to write critical comments that are also <i>constructive</i>. This is sadly often the case because learning how to write and how to empathize is a lot of work. You could start with empathizing, about which more below.
Instead, he writes about an insipid system where shittily aggressive review comments like <iq>this is not worded correctly</iq> are somehow made better by prepending the text <iq>suggestion:</iq>.
No. It does not make it better.
Why not? Well, for starters, because the text is not formulated as a <i>suggestion</i>. There is only an implicit suggestion that the reviewer would have worded it correctly. This is passive-aggressive time-wasting behavior. On top of that, <i>everything in a code review is a suggestion</i> unless the power dynamic in your team is so severely skewed that we need to be having a different conversation.
The comment should read something like, <iq>I think that something like "... ..." would be a clearer way of writing that.</iq>
Or, maybe, you could establish a <i>rapport</i> with the people reviewing your code so you're not pants-shittingly terrified that you're going to lose mana when you do one. Maybe you could---gasp!---even be friends. This would help establish a human connection often summarized as <i>empathy</i> wherein the reviewer would consider for a brief moment how a comment might look to the other side and adjust it accordingly, in a manner that is totally not like how robots would do it.
If you've established that code reviews are collaboration and not a gladiator arena where "two enter and one leaves", then the reviewer can be more concise without wasting a lot of time writing curlicue sentences. If you <i>don't</i> have this rapport, then, yes, I'm afraid you're going to have to be...what's the word?...<i>polite.</i>
If you can't be polite, then, at the very least, you should write review comments that don't need review comments of their own. You're going to have to follow the rules of <i>error messages</i>. As detailed in <a href="https://developer.apple.com/design/human-interface-guidelines/alerts" author="" source="Apple HIG">Alerts</a>,
<bq>Avoid using an alert merely to provide information. People don’t appreciate an interruption from an alert that’s <b>informative, but not actionable.</b></bq>
Any review comment has to be both <i>informative</i> and <i>actionable</i>. The comment in question---<iq>this is not worded correctly</iq>---is <i>neither</i>. It just vaguely points at something and says "you suck." It's clearly attached to a specific line but doesn't indicate what's wrong with it. Even if it said specifically what's wrong, it doesn't suggest how to fix it.
An error message from a piece of unthinking software can't go quite that far---unless it's a spellchecker or grammar-checker!---but an <i>actual, empathetic human</i> in the role of a <i>collaborator</i> can! That <i>person</i> could formulate a suggestion for how to rewrite it so that the review for that line might end after only <i>one cycle</i>. And, as a bonus, it doesn't end with anyone crying and curled into the fetal position under their desk.
Even if you have an informative and actionable comment, we still come to another downside: they're still not very efficient. The most efficient way of reviewing code is to do it synchronously or "live", where the collaborators can discuss and improve the code <i>on the fly, <b>together</b></i> maybe---and here me out here---even <i>before</i> you've even pushed anything! Imagine!
If you're stuck using PRs and web UIs to communicate, then writing comments like the one in question just wastes everyone's time. The submitter either will assume what the commentator meant and try again---NOPE, STILL WRONG---or they will have to write "what do you mean?" or "how would you have written it?" This is useless churn. Just write your reformulation with your comment. Remember, you're a <i>collaborator</i>. You're not just trying to get through this review as quickly as possible. It's part of your <i>job</i>.