TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Code reviews don't usually find bugs

13 点作者 ankitdce大约 1 年前

14 条评论

redleggedfrog大约 1 年前
Wikipedia (<a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Code_review" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Code_review</a>) says: &quot;Empirical studies provide evidence that up to 75% of code review defects affect software evolvability&#x2F;maintainability rather than functionality, suggesting that code reviews are an excellent tool for software companies with long product or system life cycles. This also means that less than 15% of the issues discussed in code reviews are related to bugs.<p>So, &quot;don&#x27;t usually&quot; equals 15%. :^)<p>Deep dive: <a href="https:&#x2F;&#x2F;www.michaelagreiler.com&#x2F;wp-content&#x2F;uploads&#x2F;2019&#x2F;02&#x2F;Characteristics-Of-Useful-Comments.pdf" rel="nofollow">https:&#x2F;&#x2F;www.michaelagreiler.com&#x2F;wp-content&#x2F;uploads&#x2F;2019&#x2F;02&#x2F;C...</a>
boolemancer大约 1 年前
&gt; When reviewers look for these logic issues, they often run through the code line-by-line using different inputs and see if any lines cause the code to produce the wrong output.<p>I don&#x27;t know of anyone that regularly does this during code reviews.<p>In my experience, automated tests help to catch regressions, i.e., they help catch error cases that people have already anticipated. If the system fails in some brand new unexpected way, you won&#x27;t have tests for it by definition.<p>Similarly, static analysis can help catch certain classes of bugs, but there&#x27;s plenty of things they won&#x27;t be able to spot.<p>Yes, they&#x27;re both useful, but neither of these is a replacement for code review. They&#x27;re all complementary.
评论 #40359174 未加载
user568439大约 1 年前
I just did a code review today where I didn’t find any bug but I forced the “developer” to rewrite the whole thing. He didn’t write a single line of code with a minimum of maintainability in mind…<p>Tests find bugs, code reviews look for quality. Sometimes I can spot a bug but it’s not my primary goal.
sfink大约 1 年前
That&#x27;s quite the evisceration of a strawman that you&#x27;ve got there. He certainly won&#x27;t be walking to Oz with Dorothy anytime soon.<p>My counterpoint:<p>- Most code reviews of my code don&#x27;t find bugs.<p>- At least half of the bugs I write are caught during code review.<p>Both are true.
pavel_lishin大约 1 年前
&gt; <i>Automated unit and integration tests are far better at finding logical bugs in code than human reviewers.</i><p>My friend, who do you think writes the tests, and how do you think they get into the system?<p>Often we&#x27;re writing new functionality. There <i>are</i> no tests for it, so they&#x27;re part of the pull request, and <i>must</i> be reviewed to make sure they&#x27;re actually testing the right thing!
评论 #40359359 未加载
thefaux大约 1 年前
80% of the value of code review comes in the preparation for review, not the review itself.
factotvm大约 1 年前
I&#x27;d like to see the difference in bug detection between &quot;pull requests&quot; vs. &quot;over-the-shoulder code reviews&quot;.<p>Edit: or, rather, in my experience the author of the code often finds the bugs when explaining it to the person standing next to them. This goes away in the GitHub-style pull request.
sackfield大约 1 年前
I&#x27;ve always thought the purpose of code review was to determine if the implementation was consistent from an architectural perspective, bug finding seems like something that should be caught by unit tests and other tools (unless you happen to catch it by chance).
Maxatar大约 1 年前
This looks like some kind of spam, I&#x27;m even tempted to say AI generated.
chrismcb大约 1 年前
I didn&#x27;t think you need to find that many bugs to make code reviews useful. Even if you only find a handful of bugs it is probably with it. Keep in mind the longer the code exists the more expensive it is to fix it. Finding a bug early can save a lot of time and money down they line. Also as someone else pointed out they can help with code quality. So they can help prevent someone adding a bug later.
deathanatos大约 1 年前
1. the submitted title does not match the article, and the article does not support the claim of the title. (Its thesis is closer to &quot;code reviews are tedious and a bottleneck&quot;.)<p>2. This is an ad.
Fire-Dragon-DoL大约 1 年前
It seems like I incorrectly presumed this was well known. I will review your code, but it&#x27;s your responsibility to figure out bugs. Sometimes I spot them though!
alserio大约 1 年前
Code reviews also help spreading good practices and knowledge
lasdjflsfj大约 1 年前
I found plenty of bugs by just reading code...<p>And yes i foster code review in my team and yes its a skill people need to learn.