The Code Review Pyramid - Gunnar Morling #293
Replies: 21 comments 15 replies
|
Good tests double as documentation. I'd place designing for testing, followed by formal verification, fuzzing, mutation testing, unit testing, and finally (rather limited) integration testing, as more important than documentation. Good function signatures and variable names also double as documentation. Think of documentation as that awful intersection crammed full of distracting signage. Should I speed up or slow down? Warning, elk sign ahead! Good product requires minimal documentation. But no amount of documentation will ever be sufficient for bad product. |
|
I had the exact thoughts as you @mcandre about putting testing under documentation but then I noticed the left side about where it is hardest to change in future and where to automate ....and then it makes sense to ensure docs are clear and concise as they are harder to evolve over time than tests are. Great illustration Gunnar! |
|
A lot of your bottom three tiers can be automated as well; There are static code analysis tools for complexity, performance, documentation, DRY, security, etc... |
|
Great breakdown - the story I'm telling myself is that implementation semantics all need tested, so having tests and documentation sections swapped might be appropriate? |
|
LGTM
|
|
In my experience a lot of time can be saved by reviewing code early. I agree that the API Semantics part - where you say to spend the most time in code reviews - is extremely important! I just think it's better to be reviewed before all the code is written. Eg. Design documents or preliminary PRS with the interface definition. |
|
I agree with most of it, except that DRY and readability (in general - code maintainability) is not "code style" and should be further down the pyramid |
|
Fantastic illustration. |
|
completely agree with you! I usually start the code review from the bottom of the pyramid. most of nits like typo or grammar things are fixed during reflecting feedback in my experience I translated this into Korean :) hope it helps Korean engineers : https://jiyeonseo.github.io/2022/04/03/the-code-review-pyramid/ |
|
nice and useful illustration 👍 |
|
nice work! |
|
Readability should be the base of the pyramid. |
|
Thank you for the great and concise guide. I want to mention that it'll be helpful to consider the "people" aspect. (It's commented by one of my facebook friend)
Also, I'm wondering if you have any tips to better recognize the things you should have changed but didn't. It's �relatively easy to leave a comment about changes made in a commit or PR, but it's quite difficult to leave a comment about what should've changed but didn't. It's more difficult if I'm not very familiar with the codebase. I can think of a few ways, but I wish there were more tools, so I wonder how you've been recognizing.
|
|
Very Well explained. It covers most of the areas of interest while doing the code reviews. Thanks for the post. |
|
I like and am sharing the pyramid with 1 significant tweak. For the kind of work we do, I strongly advocate top-down software testing. So for us the applicable "Tests" clause is, "...-Is it using Integration Tests where possible, subsystem and unit tests where necessary...." Any comment on this? |
|
Helpful content thank you ! |
|
Isn't it too late to check and discuss API Semantics, Implementation Semantics, Documentation on code review phase? From my point of view, if a dev who is working on a task feels that something needs to be discussed (security, complexity etc.), it's better to call and discuss it with other devs instead of wait until code review phase |
|
Thanks for the Dos. Now few Don'ts
|
|
This is great! Instead of "API Semantics" I would love to see it more broadly speak to "Architecture Semantics" or maybe "Architecture" could be a layer below API where we review for things like this: http://dl.apparentsoft.com/Software-architecture-tips.pdf |
|
One worth printing out for the desk area. |
|
On pyramid/triangle explanations: we all know from test automation that it's just an inverted ice cream cone. :) |
Uh oh!
There was an error while loading. Please reload this page.
The Code Review Pyramid - Gunnar Morling
When it comes to code reviews, it’s a common phenomenon that there is much focus and long-winded discussions around mundane aspects like code formatting and style, whereas important aspects (does the code change do what it is supposed to do, is it performant, is it backwards-compatible for existing clients, and many others) tend to get less attention.
To raise awareness for the issue and providing some guidance on aspects to focus on, I shared a small visual on Twitter the other day, which I called the "
https://www.morling.dev/blog/the-code-review-pyramid/
All reactions