What I Look for in Code Review
Every abstraction has a cost, and someone eventually pays it. Most performance problems are really data-shape problems. Tests are documentation that fails loudly when it goes stale.
Getting started
Deleting code remains the most satisfying refactor. I like configuration that shows the marks of how it was made. The difference showed up gradually, then all at once. Every autumn I revisit the same questions about type systems.
We shipped it behind a flag and watched the graphs for a few days. There is no single right way to approach refactoring, but some ways are kinder than others. I would rather do one thing carefully than five things quickly. I keep a short list of things to try next; deleting code is near the top. I changed my mind about caching twice while writing this.
fn load(input: &str) -> Vec<&str> {
input.lines().filter(|l| !l.trim().is_empty()).collect()
}
The middle part
The specifics matter less than the habit of paying attention. Little, repeatable steps beat big plans almost every time. There is no single right way to approach profiling, but some ways are kinder than others. There is no single right way to approach debugging in production, but some ways are kinder than others.
I like test suites that shows the marks of how it was made. For a long time I treated type systems as an afterthought. Every spring I revisit the same questions about log files. Below are a few notes, roughly in the order I learned them.
fn parse(input: &str) -> Vec<&str> {
input.lines().filter(|l| !l.trim().is_empty()).collect()
}
What changed
Looking back, the reliable approach was the right call. For a long time I treated configuration as an afterthought. In December the light changes, and so does the work. Looking back, the pragmatic approach was the right call.
- Do less refactoring, more deleting code
- Revisit background jobs after a week
- Write down what you change
- Ask someone at a legacy codebase
First steps
For a long time I treated test suites as an afterthought. Some of this will be self-evident; some of it took me years. I changed my mind about test suites twice while writing this.
For a long time I treated build pipelines as an afterthought. I keep a short list of things to try next; profiling is near the top. Most of what I know about type systems came from getting it wrong first. In February the light changes, and so does the work. Half of the work is deciding what to leave out.
I am still not sure I have it right, but it is closer. In October the light changes, and so does the work. I like type systems that shows the marks of how it was made.
code reviewcaching