Live data from Hacker News

Ask HN: Does "trust" eliminate the need for code reviews?

news.ycombinator.com

21–30 of 77 posts

Re: Ask HN: Does "trust" eliminate the need for code reviews?

#21
post #13

It depends. A lot . I work with people I do "trust" and my code-review is usually "LGTM" -- often without even looking. Most code doesn't go right to production and can be fixed if there are bugs (which I'm unlikely to find by looking at it, anyway.) The things I look at are things that are hard to change in the future: big architectural decisions, schema (db and data format) changes and things like that. More junior…

> my code-review is usually "LGTM" -- often without even looking

If you don't look how is it a review? Why not use a different response that doesn't start with "L" for Looks Good To Merge, like "approved" or "I trust it" or "review waived", e.g. one that isn't a literal lie?

Re: Ask HN: Does "trust" eliminate the need for code reviews?

#22
Hell No.

Code reviews have nothing to do with “trust”. It is another pair of eyes proof reading your code and providing at least a sanity check of the logic.

Think of this way. When you were in college you wouldn’t turn in an important paper without anyone proofreading it right? Well the code you write deserves at least as much rigor as your sociology term paper did.

Re: Ask HN: Does "trust" eliminate the need for code reviews?

#23

No. I trust myself. I still want someone to review my work. If nothing else than to essentially catch typos. You can’t proofread your own output.

Yeah, I know that I tend to avoid the broken stuff in my own code and/or only test it along happy paths because I know how it's supposed to work. I can work around that, sure, but IME there's a certain kind of blindness to things that comes with familiarity - a fresh set of eyes is a good way to mitigate that.

Re: Ask HN: Does "trust" eliminate the need for code reviews?

#24
Interesting idea, but I think Pete is suggesting a bad solution for a very real problem. Code reviews tend to be slow, and reduce development velocity. But the solution isn't to merge un-reviewed code into master. The solution is to create a culture where people prioritize unblocking one another and doing code-reviews promptly.

I once worked in a team where people did code-reviews within 2 hours of a pull-request being published. We moved so much faster as a team than any other team I was a part of. I bet there is a high correlation between team velocity and code-review latency

Re: Ask HN: Does "trust" eliminate the need for code reviews?

#26
> merge first, for the sake of high velocity

I think what constitutes high velocity or best practice is going to be highly dependent on the context. What's the risk and consequences of a mistake, for example?

If you are making some Crud SaaS and you are in an early/startup setting then obviously you can probably correct a mistake pretty quickly. Perhaps you haven't even shipped the product publicly. Worst case a service is unavailable or some data is deleted that can be recovered from backup. Bad day at work but you'll recover.

But what if you are in a security critical business? What if your code is deployed to customers and it writes files using a file format that must be possible to read forever, and this code contains a bug making those files incorrect?

So: your review process, source control workflow, testing method, CI method, etc. will depend on the context, just like the best architecture. (insert Simpson meme with "-Say the line senior developer -it depends").

Anyone who tries to offer "best practices" without caveats is either misinformed or selling snake oil (LinkedIn is the place to go if you want both of those).

Re: Ask HN: Does "trust" eliminate the need for code reviews?

#28
If you're not going to review the code before merge, then you certainly aren't going to review it after it's been merged.

It's one of the reasons that I write my tests before the code, I know that if I write the code first then I'm less likely to write any tests for it.

Re: Ask HN: Does "trust" eliminate the need for code reviews?

#29
post #24

Interesting idea, but I think Pete is suggesting a bad solution for a very real problem. Code reviews tend to be slow, and reduce development velocity. But the solution isn't to merge un-reviewed code into master. The solution is to create a culture where people prioritize unblocking one another and doing code-reviews promptly. I once worked in a team where people did code-reviews within 2 hours of a pull-request bei…

[deleted]

Re: Ask HN: Does "trust" eliminate the need for code reviews?

#30

No, of course not, everyone makes mistakes. But also the point of code review is not just to catch mistakes, suggest improvements, etc, but as a way to learn and keep up-to-date with the code base, and also to pick up tips or whatever from other developers. And I guess a meta-point is it's one of a number of practices that makes the team a team.

Trust can exist while recognizing limitations. In fact, I would say understanding limitations is integral to trust. And limitations is why we do code review.
Post reply on HN