Live data from Hacker News

The primary purpose of code review is to find code that will be hard to maintain

mathstodon.xyz

111–120 of 193 posts

Re: The primary purpose of code review is to find code that will be hard to maintain

#111
post #79

Earlier quoted context omitted.

We even find ourselves creating PRs in situations where the code is going to be merged immediately anyway, and tagging other devs, just so they have a convenient way to see what got merged and why. So people don't lose track of what is in the codebase.

this is a great way to train people to ignore PR emails/notifications

Maybe but those people are also having claude summarize their inbox and get nice little daily reports on things they might want to look into.

Re: The primary purpose of code review is to find code that will be hard to maintain

#112
post #109

Code review doesn't have a single purpose. Finding code that is hard to maintain is one of those, and and an important one, but certainly not the only one, and I'm not sure it is even the most important one. Other purposes include: - a safety check to ensure that if a developer (or AI) goes rogue, it is more difficult to merge malicious code - a second perspective from someone who isn't as close to the problem and mi…

100% agree. It's as if you read the first sentence out of my mind. Thanks.

Re: The primary purpose of code review is to find code that will be hard to maintain

#113
It's kinda funny that we all agree that code review is important but we cannot agree why exactly it is important. Imagine a bunch of ancient shamans arguing why exactly local volcano needs to be fed one virgin a year but all being in agreement that it does.

Re: The primary purpose of code review is to find code that will be hard to maintain

#115
post #109

Code review doesn't have a single purpose. Finding code that is hard to maintain is one of those, and and an important one, but certainly not the only one, and I'm not sure it is even the most important one. Other purposes include: - a safety check to ensure that if a developer (or AI) goes rogue, it is more difficult to merge malicious code - a second perspective from someone who isn't as close to the problem and mi…

Another—very old—rationale:

People write code differently when they know that it will be reviewed by people who will not only comment on it, but also form long-term impressions of the submitter's competence and fit based on the code that is reviewed.

Re: The primary purpose of code review is to find code that will be hard to maintain

#116
post #16

What I find to be maybe the single most important part of code review is knowledge transfer. Our entire small team thumbs up a PR before it's merged unless there's a big rush on it, and this gives everyone on the team a rough idea of the state of the codebase at any given time. There's no being blindsided like "this whole system I depend on is gone" like I had happen at far more siloed places I've worked. Beyond that…

Decisions by small groups should be the default. Others only need to be involved if the risk/consequences of failure are high.

I started ignoring all PRs from our large team because we had a similar policy. My teammates can handle, they don't need me to check on each PR.

Re: The primary purpose of code review is to find code that will be hard to maintain

#117

The other issue with code review, and I'm glad I've not worked with people like this anymore, for the person being reviewed: NOBODY IS ATTACKING YOU, nobody is saying your code is bad, the goal is to do a once-over for quality. Another goal people often miss: It's okay to ask "stupid questions" and I would argue as a Junior, ask away, even if no code changes happen, ASK. Kind of follows the spirit of the original pos…

>NOBODY IS ATTACKING YOU Somehow this captures a lot of the culture for me.

Places I work at weed out for this. If people cant take peer review they sour the workday for others.

You were not hired to write perfect code, relax.

Re: The primary purpose of code review is to find code that will be hard to maintain

#118
post #83

Earlier quoted context omitted.

Such a luxury, I am envious! Our team started using AI, so I switched to a simple method: no comments, and a binary "is this batshit crazy or passable" approval decision rule. Saving myself time and sanity.

In other words, AI code is owned by nobody.

Tragedy of the commons

Re: The primary purpose of code review is to find code that will be hard to maintain

#119
post #115
post #109

Code review doesn't have a single purpose. Finding code that is hard to maintain is one of those, and and an important one, but certainly not the only one, and I'm not sure it is even the most important one. Other purposes include: - a safety check to ensure that if a developer (or AI) goes rogue, it is more difficult to merge malicious code - a second perspective from someone who isn't as close to the problem and mi…

Another—very old—rationale: People write code differently when they know that it will be reviewed by people who will not only comment on it, but also form long-term impressions of the submitter's competence and fit based on the code that is reviewed.

This is the big one IMHO. I've been part of teams where there was zero code review, and where the code reviews were intense, and for sure people write much better code (generally speaking) when they know it will be reviewed. We all do it, even if subconsciously.

I do advocate a balance though. Ridiculous code reviews tend to slow the process down immensely, which is good for some things but bad for others. Finding a good balance is super important IMHO

Re: The primary purpose of code review is to find code that will be hard to maintain

#120

The other issue with code review, and I'm glad I've not worked with people like this anymore, for the person being reviewed: NOBODY IS ATTACKING YOU, nobody is saying your code is bad, the goal is to do a once-over for quality. Another goal people often miss: It's okay to ask "stupid questions" and I would argue as a Junior, ask away, even if no code changes happen, ASK. Kind of follows the spirit of the original pos…

Not true. I’ve attacked people before in the sense I was disgusted with the short cuts they took and the things they tried to get away with in the code.

I’ve seen the malicious deletion of features in order to stay hidden and I’ve called it out.

Post reply on HN