惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
Check Point Blog
AI
AI
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
U
Unit 42
Vercel News
Vercel News
Stack Overflow Blog
Stack Overflow Blog
P
Proofpoint News Feed
Microsoft Security Blog
Microsoft Security Blog
The GitHub Blog
The GitHub Blog
WordPress大学
WordPress大学
Martin Fowler
Martin Fowler
博客园 - 【当耐特】
B
Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
F
Full Disclosure
Google DeepMind News
Google DeepMind News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
H
Help Net Security
Recorded Future
Recorded Future
N
News and Events Feed by Topic
雷峰网
雷峰网
V
Vulnerabilities – Threatpost
Schneier on Security
Schneier on Security
aimingoo的专栏
aimingoo的专栏
S
Schneier on Security
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
O
OpenAI News
Project Zero
Project Zero
罗磊的独立博客
G
GRAHAM CLULEY
腾讯CDC
P
Privacy International News Feed
V
V2EX
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Hugging Face - Blog
Hugging Face - Blog
爱范儿
爱范儿
H
Heimdal Security Blog
L
LINUX DO - 热门话题
Forbes - Security
Forbes - Security
美团技术团队
MongoDB | Blog
MongoDB | Blog
Security Latest
Security Latest
M
MIT News - Artificial intelligence
T
Tor Project blog
Cisco Talos Blog
Cisco Talos Blog
宝玉的分享
宝玉的分享
T
Threat Research - Cisco Blogs
TaoSecurity Blog
TaoSecurity Blog

Sophie Alpert

There are no lossless transformations of natural-language text Deconstructing “services” I don’t want AI agents controlling my laptop Materialized views are obviously useful TODOs aren’t for doing Everyone is wrong about that Slack flowchart Hire me to empower and upskill your eng team How React Changed the Web Forever: A Documentary Fast and maintainable patterns for fetching from a database React Conf: “Building a Custom React Renderer” Metrics by proxy Yak shaving and fixing Voice React Conf: “React Today and Tomorrow” Why we host conference talk dry runs React Podcast: Inside React Type errors with inference need stacks Observable programming React 16: an API-compatible rewrite Hi, I’m trans. Initializing on the main thread using dispatch_once A near-perfect oninput shim for IE 8 and 9 Using React to speed up the Khan Academy question editor What I did at Khan Academy, 2012 edition Preventing XSS attacks when embedding JSON in HTML Rolling back to an old revision in Mercurial (like git reset)
Why review code?
Sophie Alpert · 2018-12-25 · via Sophie Alpert

A friend asked me recently why it’s valuable to do code review. Most Silicon Valley tech companies, at least, do code review on every change to get at least two sets of eyes on it. At one of my earlier jobs we did opt-in code review (rarely) for a while, then a new employee coming from Google joined us and encouraged us to review all our code — which we did. It was a great decision.

If you do it right, code review shouldn’t feel onerous. You and your reviewer aren’t adversaries; you’re working together to build the best software you can together. (It’s important to not take feedback personally — even if your code needs to be changed, that doesn’t mean you are problematic. It’s normal to get feedback, and that’s what helps you grow!)

Some companies have complicated rules about how many people have to review each piece of code, with strict “owners” for who is responsible for each piece of code. I’ve never felt that to be necessary; I prefer a simpler system where the only rule is that each piece of code must be reviewed by one person. In practice you’ll still send reviews to the people responsible for maintaining the particular code you changed, but it’s nice to not have the hard requirement.

Here are the biggest reasons I thought of for why code review is valuable. There’s a lot of them!

  1. The code itself. The most obvious value in code review is often framed in “catching bugs”. Or if you look a little further, catching cases where there are best practices or unspoken rules that the author didn’t know about, where a reviewer can help make the actual concrete code better by responding to it.
  2. Macro-level knowledge sharing. When you review other people’s code, you tend to learn new techniques that can benefit you later — and vice versa, if someone suggests a better way to do something when your code is under review. If you can take what you learned and use it later, you’ll grow as an engineer.
  3. Micro-level knowledge sharing. Or, mitigating the “bus factor” by increasing the number of people who are familiar with any given piece of code.
  4. Direction sharing. Relatedly, code review forces you to communicate to teammates what you’re doing, which helps ensure that you don’t end up going in a wrong direction for days or weeks by giving them a chance to push back.
  5. Communication practice. Being able to communicate clearly, both within a team and beyond it, is one of the most important skills for succeeding at work! Code review gives you a chance to practice writing clearly, both in describing the purpose of a change and when giving feedback on one. With any luck, you’ll be more prepared for the next time you need to write something that “really matters”.
  6. Historical record. In my experience, people tend to write much better commit messages when they know someone’s reading them. That’s often useful later when looking back at old changes!
  7. Something to discuss. When you’re trying to agree on what change to make, it can sometimes be hard to verbally describe and agree on the specifics of, say, a particular algorithm. Communicating over a piece of code can be more precise, since code tends to be unambiguous.
  8. Team cohesion. When you do regular code reviews, work feels a little more like a single team working together instead of each person operating “in their own lane”.
  9. Reading practice. Getting practice reading other people’s code helps you remember how to make your own code more readable (and thus, maintainable). Which leads to better code forever after!

If I had to pick, reasons 2, 5, and 6 probably stand out to me as the most valuable.