TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Code reviews aren’t just for catching bugs

210 pointsby srcabout 9 years ago

21 comments

buro9about 9 years ago
I&#x27;d still rather earlier code reviews... design reviews about 1&#x2F;3 of the way into writing the code. Enough time to have passed to have discovered the dragons in the whiteboard design, but not enough to have written code that could only undergo minor fixes in a code review.<p>I prefer the idea of a code review happening at a time that it could still steer the ship... too many code reviews catch bugs, but don&#x27;t correct poor system design. That&#x27;s also where the greatest benefit&#x2F;education exists for the author... not minor changes, but &quot;what about approaching it like this&quot;.
评论 #11685975 未加载
评论 #11686447 未加载
评论 #11685928 未加载
评论 #11685888 未加载
评论 #11686217 未加载
评论 #11686760 未加载
评论 #11686839 未加载
wellpastabout 9 years ago
What often goes unmentioned in praise for code review processes is their insanely exorbitant costs -- measured in engineer hours but perhaps more costly is all of the blocking and impedance [1]. Most of the &quot;problems&quot; that code reviews claim to address can be solved by much more direct and optimal measures. Code reviews are damn expensive.<p>This post concedes that code reviews are better for the more fluffy ends -- teamwork, openness, social recognition, but given their high costs, I&#x27;d rather achieve even these soft goals in other ways than to impede my team&#x27;s delivery potential.<p>While mission critical systems deserve the whole kitchen sink thrown at them, expensive verifications, code reviews, etc etc., most business applications would do much better optimizing for better software architectures and domain conceptualization than spend so much time dwelling on the minutiae of lines of code.<p>[1] Continuous integration and refactoring, pillars of agility, go out the window in typical code review environments where commits are blocked until peer review.
评论 #11686143 未加载
评论 #11689087 未加载
评论 #11686298 未加载
评论 #11688708 未加载
评论 #11686676 未加载
评论 #11686252 未加载
评论 #11686113 未加载
评论 #11689346 未加载
评论 #11687475 未加载
评论 #11686139 未加载
wandernotlostabout 9 years ago
While I value many of the same things as the author, I&#x27;ve found code reviews to be far inferior in every respect to pairing (especially promiscuous pairing (google it)), and to have negative effects in several important ways:<p><pre><code> * They delay integration. * They tend to encourage focus on abstract code polishing without proportionality or relation to the value of the code. * They favor superficial improvements, while increasing the costs sunk into paths that may be deeply flawed. (They facilitate late code-structural feedback, but not early directional&#x2F;problem-analytical feedback.) * They often discourage more collaborative work and therefore quicker and richer feedback, by their presence as a substitute for pairing. * They create impediments to work moving quickly to completion. </code></pre> Of these, the most egregious is the distraction from value. Teams that are spending a lot of time and energy talking about code quality (which is absolutely important, but not primary...the best teams I&#x27;ve seen maintain a high level of quality and talk about tradeoffs involved in delivering value at high quality) are often neglecting communication about where value lies and how to deliver it most efficiently.<p>[edited for formatting]
评论 #11689124 未加载
评论 #11688920 未加载
msoadabout 9 years ago
Code reviews can easily become a tool for people with huge egos to prove their smartness. I get code review comments for grammar of my comments or very small code style preferences that Google&#x27;s anal style guide can&#x27;t enforce (yet).<p>I like code reviews, don&#x27;t get me wrong. But there should be a way to respond with &quot;you just shut up, you&#x27;re only trying to make yourself look smart&quot;.<p>It&#x27;s all because higher up people mostly look at code review conversations this is happening. The other day I asked my peer how do I write this code? A or B? He said I don&#x27;t care, A seems fine. Then in code review he commented it should be done in B way.<p>It&#x27;s all politics.
评论 #11686232 未加载
评论 #11686208 未加载
评论 #11686362 未加载
评论 #11687920 未加载
评论 #11690404 未加载
评论 #11689198 未加载
评论 #11686178 未加载
hangonhnabout 9 years ago
I would go further and say that you should never trust code reviews to catch bugs. They&#x27;re great for all the reasons in the article and what &quot;zhemao&quot; said but they&#x27;re horrible for catching any bugs beyond the most trivial ones. Humans simply aren&#x27;t good at running code in their head like that. Code review is no substitute for good code coverage and automated testing, preferably pre-commit.
评论 #11686627 未加载
评论 #11686264 未加载
评论 #11686335 未加载
评论 #11686348 未加载
zhemaoabout 9 years ago
I think a benefit not mentioned in the article is that it makes sure that at least one person besides the original author understands what the code does.
评论 #11686502 未加载
评论 #11686752 未加载
评论 #11687060 未加载
评论 #11686994 未加载
aczerepinskiabout 9 years ago
I&#x27;m a dev with one year&#x27;s experience, and recently moved to a team that reviews every PR. The benefits to me personally are super clear. #1, more experienced engineers are giving me frequent feedback, and that&#x27;s obviously worth a ton. #2, it&#x27;s part of my job to read other developers&#x27; code. I get exposed to patterns and design choices that I may not have in my repertoire.<p>Maybe the feedback I give the other direction isn&#x27;t yet as valuable as what I receive on my PRs, but I trust that eventually it will be.<p>I totally get the posts pointing out that during crunch time, folks do pretend reviews, and the process becomes busy work. I think that&#x27;s a symptom of other problems though (staffing model, etc), and not necessarily a shortcoming of peer review in general.
评论 #11698138 未加载
gracenotesabout 9 years ago
As several other commenters have pointed out, code reviews are not a silver bullet. It is widely known that there is no silver bullet.<p>That said, if your goal is to make a quality product, you shouldn&#x27;t have to choose between code reviews and continuous integration. You shouldn&#x27;t have to choose between code reviews and code coverage, or manual QA processes. These are all widely regarded as best practices and if implemented &quot;correctly&quot; and appropriately to the team their combination forms a virtuous cycle for code health and team culture.
raldiabout 9 years ago
Code reviews : good programming habits :: sexual reproduction : good evolutionary traits<p>They make them spread much much faster than they otherwise would.
edurenabout 9 years ago
Working at a Gov&#x27;t IT contractor, I really wish we had the organizational skills&#x2F;incentive to do code reviews. Very rarely does the code I write get glanced at, much less examined.<p>My instinct, of course, is to solicit code reviews from my peers, but the organizational structure and support tooling are all woefully inadequate. Plenty of projects, even greenfield ones, aren&#x27;t checked into source control. And of course if I spent time contacting those in my org that have similar skills and could thus review, not only would I have to justify it to my 3-4 managers, but so would the person I solicited for review to their own.<p>Nobody cares about the code quality, and thus it has been a nightmare for me trying to improve my skills right out of school. Here&#x27;s to hoping I get out soon.
评论 #11686151 未加载
评论 #11686157 未加载
评论 #11686293 未加载
danielweberabout 9 years ago
At a software shop about ten years ago I loved code reviews. They were a major way of learning and teaching things. I stopped doing some silly (albiet harmless) habits when other people pointed them out.
maxxxxxabout 9 years ago
How do people handle reviews of highly specialized stuff? We have people who do stuff nobody else on the team understands or at least it would take them a long time of learning to do a real review. I look at a lot of stuff and check if it makes halfways sense. I can look at the coding style but I can&#x27;t judge the overall design without spending many hours on it (which I don&#x27;t have. Nobody else on the team has it either).<p>I am starting to think that pair programming may use up less engineering time than doing thorough reviews.
评论 #11688292 未加载
评论 #11686556 未加载
waiganiabout 9 years ago
This is a topic close to my heart. I’m a software engineer for Canonical (company behind Ubuntu). Last year I did a study of the total review wait time over a two month period, which came out to be 8683hrs ( <a href="http:&#x2F;&#x2F;lingo.reviews&#x2F;d3&#x2F;juju_review_wait_times.html" rel="nofollow">http:&#x2F;&#x2F;lingo.reviews&#x2F;d3&#x2F;juju_review_wait_times.html</a>).<p>I wrote up my thoughts around scalable engineering here: bit.ly&#x2F;1P0YgNo and released an MVP solution here: www.lingo.reviews<p>Since then I’ve been refining privately with a handful of engineers from different companies. Two days ago I put in my notice and took on solving the problem of scalable engineering as a full-time mission: <a href="http:&#x2F;&#x2F;codelingo.io" rel="nofollow">http:&#x2F;&#x2F;codelingo.io</a><p>I&#x27;d love to connect with anyone that is passionate about this problem (it&#x27;s been a 2 year obsession for me): jesse@codelingo.io
goda90about 9 years ago
My employer develops safety critical software with decades of legacy code, long term support for multiple versions, and big customers. In our attempts to transition(in a mock way for the time being) to rolling releases we&#x27;ve &quot;simplified&quot; to a process with 3-5 people reviewing designs, 2-3 developers doing code review&#x2F;light testing, 2-x(depending on affected modules) quality assurance people doing heavy testing and occasionally we pair program. Documentation&#x2F;logistics is almost always more time consuming than design and development. I&#x27;ve had 4 character code changes take weeks to get through the process as several people have to find the time to look at it even for just an hour. It&#x27;s cumbersome but we do catch a lot of bugs, and we&#x27;re slowly getting better at design.
voidrabout 9 years ago
Code reviews:<p>* signal distrust by default - the work I do is not to be trusted to be merged in and by extension, I&#x27;m not to be trusted<p>* can create a culture of passive aggressiveness - you do something that I don&#x27;t like, I&#x27;ll get back at you when I&#x27;ll review your code<p>* not guaranty code quality - having a junior review a junior&#x27;s code will not yield expert level code<p>Just because Google does code reviews doesn&#x27;t mean you should, for Google a bug could cost millions, for your project a bug might cost 10$, however the overhead of code reviews might cost more than 100$. It&#x27;s important to do numbers and think rationally.
评论 #11689383 未加载
评论 #11689170 未加载
评论 #11689132 未加载
评论 #11689155 未加载
评论 #11689490 未加载
harwoodleonabout 9 years ago
What about the stress of continuous evaluation? How does the company view that? Standards are great to maintain, but people aren&#x27;t robots. I question the value of the word &#x27;review&#x27; in this context and its blocking nature.<p>Pair programming is a far more effective tool, but it&#x27;s not always practical. How about using the terminology of &#x27;collaboration&#x27; instead of the test based culture - which I feel turns people into machines - it&#x27;s just the wrong control structure for people to be happy.
V-2about 9 years ago
&quot;not JUST for catching bugs&quot;? I always thought catching bugs is the least of their purposes
BurningFrogabout 9 years ago
Maybe I&#x27;m an arrogant XP-ist, but to me this sounds like a good step on the way to pair programming.
评论 #11686437 未加载
评论 #11690459 未加载
mirekrusinabout 9 years ago
In small&#x2F;medium teams, especially remote ones, code review helps you keep understanding of the system - you already know what your code does and it&#x27;s great way to learn the rest of the system.<p>In some sense, it can be looked at, as asynchronous pair programming.
xyzzy4about 9 years ago
Requiring code reviews before the commit is a bureaucratic waste of time and resources. If they non-mandatory and after the commit, then they can be a good idea.
评论 #11686041 未加载
评论 #11686046 未加载
qaqabout 9 years ago
You can often have 100% test coverage and critical change code reviews, for about same cost as doing code reviews for each commit.
评论 #11686548 未加载