Every once in a while I get an opportunity to share my 4 reasons to leave a code comment:
1. An odd business requirement (share the origin story)
2. It took research (summarize with links)
3. Multiple options were considered (justify decision)
4. Question in a code review (answer in a comment)
Important caveat for number 4: if your code can be restructured in a way that answers the question without a comment, do that instead.
This originally comes from an article[1] I wrote in 2021 titled "Writing Maintainable Code is a Communication Skill".
[1]: https://max.engineer/maintainable-code
I think there's probably a 5th one that's new-ish. Code isn't where the value is now that agentic tools can whip out a solution to just about anything in no time, so the commentary provides semantic grounding that allows you to navigate generated code easily.
It's kind of like some of the existing reasons, but there is a difference there.
Code reviews are not only about raising quality, but mainly about communicating changes to the wider team. Suggesting to eliminate code reviews when LLM use is so rampant is also quite uhm courageous.
Communicating changes and communicating learning too! Every few years I rewatch one of my favorite videos on code reviews: https://www.youtube.com/watch?v=PJjmw9TRB7s.
Asking questions on code reviews is one of the most powerful tools to learn more about a codebase, and fostering a culture where junior devs feel empowered to ask questions is one of the best ways to help junior devs succeed.
The author never suggested to eliminate code reviews entirely. Just to give individuals more autonomy, which is great in my book.
PRs don’t really hurt autonomy if stacked branches are used routinely. Those do hurt speed, yes, but not autonomy. PRs are so important that I‘d never skip them within a team.
If you have a policy in place that forces engineers to wait for review before merging each PR, then yes, by definition they have less autonomy. It might still be worth the trade off in your situation, but I like the suggestion in the article where senior devs can decide themselves whether they want their code reviewed or not.
Hard no buddy. Junior dev means junior code and junior judgement. Countless times we had prod issues because some dev thought the change was harmless and they didn't need review.
In the article, they specifically exclude juniors and people who are still being onboarded.
I can’t find that disclaimer in the article.
Sometimes code reviews and approvals are required due to various conpliance regimes that dictate it as part of the Software Developement Lifecycle (SDLC).