Code review is a key part of our development process. All code changes should go through code review before they are released. Sometimes it feels hard to justify waiting for another developer to take the time to do a code review, but it has tremendous value. At Culture Foundry, our code review is a bit more involved than just reading the code. The reviewer should download the branch to their local environment, follow the deploy instructions (if present) and make sure the code “does what it says on the tin”. The reviewer also should read the code in the pull request and see if it is understandable, if the intent of the code is clear and if the organization of the code fits in with the existing project.
This deeper code review process has these benefits:
- For me, when I write the code, I take a bit more time to clean things up when I know a peer will be looking at it.
- Like most code reviews, this process allows the team to center around a set of evolving norms on how code is written. The code reviewer has the chance to weigh in on logic, method names and other software constructs (“I don’t understand why you used an array instead of a map”). They can insist on refactoring and tests where appropriate and bring their knowledge of how other work for a given client has been done (“you may want to look at the ‘foo’ component because it does something similar”) to bear.
- This is a first pass of QA. The reviewer should read the card describing the work and can catch bugs. Given that they are reading the code in tandem with running it, this is classic white box testing. This testing is especially important for aspects of the code that will be exercised by the deployment (which a black box testing won’t handle).
- Most important, code review forces an osmosis of knowledge. By standing up the environment and running the code, the reviewer can see the ‘lay of the land’ for the project. They do this in the normal course of the day without impacting their work too much. It is cross training developers while improving code quality. (The typical code review takes between 15 minutes and an hour.)
For all these reasons, code review is a fundamental part of the Culture Foundry development process.