Live data from Hacker News

No code reviews by default

raycast.com

241–250 of 315 posts

Re: No code reviews by default

#241
This is a remarkably frustrating read. Of the value we get from code review, catching bugs is one of the smallest.

Things we catch include

- Duplicating functionality we have elsewhere. - Duplicating business logic we are elsewhere. - Recommending cleaner abstractions, particularly with younger devs. - Query optimization - The time for your DBA/data developer to review things is well before they are a problem.

Developers with this focus on “speed” in my experience tend to build a lot of throwaway code.

Re: No code reviews by default

#242
This works great when team size is tiny and everyone is an experienced engineer. I grew my team from just 2->8. Without a robust CI/CD pipeline and establishing code review practices we would have been breaking prod every other day.

I agree with author that trust is proportional to velocity. But it takes sometime to build that trust. Writing code reviews is skill that engineers need to acquire. A lot of that is emotional quotient than IQ. Code reviews should give context to the PR owner that {s}he doesn't have by just going through the code. Let the review bots and other integration tests take care of breakage etc.

I check PR stats for my teams repo and track mean time of PR approval and few merge time metrics. This is just to make sure, that there is no back and forth happening during reviews and median time to merge PR is relatively constant. One can leverage these metrics to know which team member is being a douchebag.

Re: No code reviews by default

#243
This is written by a company that recently raised a series A[1], so I'm not surprised they're willing to optimize for velocity at all costs. It's not the worst trade-off you can make at that stage, but it's a trade-off only worth making early on. And I would argue trust (or lack thereof) shouldn't be a factor in code reviews.

Most of the value of code reviews comes into play when working on more mature systems that sit on top of a stable foundation. And the benefits of those reviews are significant: they help socialize the codebase (I'm using socialize rather than "understand" because I don't think you can get a complete picture of it by doing them, but you can lay down a mental foundation from them) to the team, they let you share techniques and information on how to best utilize a given tech stack, catch missing test cases, identify faulty assumptions, and help Jr/Associate level engineers to be stronger contributors. I've also seen them used successfully as glorified whiteboards/sketchpads to share and develop ideas between engineers.

To extract this value out of code reviews, there are a three key things that must be done.

First, automate as much dumb bikeshedding as you can: have precommit hooks for code formatting, linting, type checking, dependency validation, test coverage etc. Tools already exist for most languages to do this, so you're not stuck having to write your own. A few dozen lines of YAML eliminates hundreds of hours of worthless debates and churn. Nobody should waste time commenting about this stuff.

Second, avoid "large" PRs. Don't get too caught up in change sizes, but think more about "How many major components will people actually need to review?" Sometimes a 2000-line changeset has 1500 lines you just skim and 500 lines of real stuff you have to pay attention to.

Third, you need to give some context in the PR message. Link out to relevant things, explain what you doing, and even call stuff out you want people to see "Please draw your attention to FooBar in baz.py - I'm a little unsure this handles all situations"

Code reviews often get wedged into SDLCs because someone broke something in prod and people concluded "code reviews would've prevented this!" -- I personally think this is the wrong mentality. You should instead see them as a way to improve the quality of the codebase and your team's skills and knowledge. Rather than trying to "catch" a catastrophic production bug, focus instead on reducing the number of catastrophic bugs that get created in the first place - via better tests, better shared understanding, and sharper skills.

[1] https://techcrunch.com/2021/11/30/developer-productivity-too...

Re: No code reviews by default

#244
post #14

Earlier quoted context omitted.

If something hit production and caused a major fuck-up because there was no peer review process, then in all the places I've worked at the first action item in the post-mortem would be "we should introduce peer review." Otherwise someone would ask how we could ensure it wouldn't happen again, and no one would be able to say "because we trust them," and leave it at that. It would sound more like "I trust you will neve…

Exactly. I want my code peer reviewed partly because it makes it clear and formal that while we succeed as a team we also fail as a team. It’s much easier to talk about failures when a failure doesn’t have a single person attached to it.

> I want my code peer reviewed

TFA:

> Engineers [..] request reviews when they think it's necessary.

Problemo solved.

Re: No code reviews by default

#245
post #222
post #27

Earlier quoted context omitted.

Yeah, IMO this is like a publisher saying "we don't have editors: we trust our authors". The intended ethos of editors and code review is that mistakes and imperfections are the norm, and you need a second pair of eyes to iron them out. That said, I do sometimes encounter individuals or cultures that seem to view code review more as a mechanism for catching abnormal/unexpected mistakes than as a normal part of the pr…

Books are published once, not through iterations. The equivalent in book writing would be that you are not allowed to write more than one page at a time, and someone must approve it before you start working on the next page.

[deleted]

Re: No code reviews by default

#246
post #7

He mentions "trust" a lot. Is that why we do code reviews, because we don't trust each other? I find this attitude problematic. We do code reviews because humans make mistakes. Requirements can be misinterpreted. Different work in progress can be in conflict with each other. Reviews are a good way to learn from each other and keep abreast of what work is occurring outside your own bubble. Not doing code reviews becau…

> Is that why we do code reviews, because we don't trust each other?

I don't see any other reason to require code reviews before a change can be merged.

> humans make mistakes

Then write unit tests, religiously. And pair. Or "... request reviews when they think it's necessary".

In my experience code reviews are not very good at catching mistakes.

> Different work in progress can be in conflict with each other.

Code reviews are the cause of too much work in progress, not the solution. Not the only cause.

> Reviews are a good way to learn from each other

In my experience, they are pretty bad at this. Pairing is vastly superior, or giving talks.

> reason to communicate with devs I might not otherwise communicate with

Then communicate with them. And if you want a review "... request reviews when they think it's necessary".

> Rejected

Exactly. That's not a useful form of interacting with your peers.

Re: No code reviews by default

#247
post #226

It probably makes sense when all the developers are experienced seniors with deep knowledge of the codebase, but often it's not the case. I don't think it scales beyond a small team of senior founders who only start making their first MVP. According to Crunchbase, they were founded 2 years ago and have below 10 employees. At our company, code reviews help: 1) onboard new devs and teach them about the codebase, catch…

The article is not saying that no code reviews are done, but that it is not manditory. For on boarding code reviews are useful, but you could also do some pair programming or work together on the code.

We have not only code reviews, but also mandatory architecture reviews. Everyone dumping random code to main doesn't scale in the long term without a coherent architectural/technical vision. Without it, it's very likely to end in a Big Ball of Mud. We started that way too - faster iterations, little design, and it did help us gain some foothold, but after a few years it became unmanageable and hard to extend/mantain. It's been 3 years since we started untangling our legacy system built that way and our growth is still impeded by it. Context matters: their approach works OK if you're only starting out, but at some point you're going to rethink your processes. Many (most?) companies start that way, foregoing code reviews, even tests and proper QA, to release earlier; but eventually you start to appreciate them as your product matures. It's important to not miss the moment when your codebase becomes large/complex enough that you need to rethink your processes.

Re: No code reviews by default

#248
post #222
post #27

Earlier quoted context omitted.

Yeah, IMO this is like a publisher saying "we don't have editors: we trust our authors". The intended ethos of editors and code review is that mistakes and imperfections are the norm, and you need a second pair of eyes to iron them out. That said, I do sometimes encounter individuals or cultures that seem to view code review more as a mechanism for catching abnormal/unexpected mistakes than as a normal part of the pr…

Books are published once, not through iterations. The equivalent in book writing would be that you are not allowed to write more than one page at a time, and someone must approve it before you start working on the next page.

> Books are published once, not through iterations.

Incorrect. Bugs (“errata”) are regularly fixed in bugfix versions (“printings”) of books, whereas feature changes are regularly fixed in more major versions (“editions”). And that’s after the equivalent of a “1.0” release.

Books are also regularly iteratively released either to a closed group of reviewers or even the public (e.g., Manning MEAPs, PragProg Beta Books, etc.) prior to the equivalent of a “1.0” release.

Re: No code reviews by default

#249
This was the way most software was built. In the past decade, there has been a heavy reliance on code reviews, perhaps because of the rise of dynamic languages where it helps to have test coverage and eyeballs on the code to get close to the help that a compiler provides. Is the software of this decade much better quality-wise than the stuff built without resorting to extensive code reviews? I doubt it somehow.

Code review has become a way to design by committee: if every team member gets to critique one aspect or another on every code review, most design paradigms will fail to make it through the gauntlet of the ad-hoc design process the code review entails.

Code review has also become a way to micromanage individual contributors without explicit effort from the engineering manager or similar authority figure. It can now be administered by your colleagues who can now revel in the power that it gives them over you.

Finally, code review is the ultimate busy-work that caters to the conceit of today's software developers: that they are craftsmen who produce bespoke objects of art and beauty. After all, if each piece of code is so thoughtfully critiqued and subjected to such scrutiny, it must be exquisite indeed! Oftentimes the reality is that the team comprises a half-dozen overqualified people polishing a turd that exists to squeeze both sides by creating a cozy monopoly or an oligopoly in a two-sided market. But that is too embarrassing to admit, and it certainly doesn't bode well for pulling in obscene amounts of funding and prestige!

Re: No code reviews by default

#250
post #208
post #129

Coming up next: “We don’t use source control. Git just slows us down. Our engineers don't want to spend time writing commit messages when they can be writing features instead. We keep all our code in a shared folder and we trust our team members to not mess it up!” Well, this can be done. Lots of software was written before code reviews or source control existed. But I’m not longing for that time.

Early Facebook is one notable example.

[deleted]
Post reply on HN