Not too long ago I ordered the free book Best Kept Secrets of Peer Code Review by Jason Cohen. Jason is the man behind the CodeCollaborator code review tool – Go figure. The book has it’s obvious marketing points, but that doesn’t detract from the excellent content.
In the book Jason writes about the benefits of Code Review – common practices, pitfalls and benefits. He’s concise, easy to follow and the book is an enjoyable read. I took away a lot from the book. There are a ton of “golden nuggets” many of them worth noting:
Code Review Benefits
- Code reviews catch bugs before they go out the front door.
- Team knowledge (like best practices, common errors, or standards) is spread quickly when performing code reviews.
- Code review is an excellent method for bringing outsiders up to speed on code.
Code Review Principles
- Defects per line of code is an unreliable metric.
- Omissions are the hardest defects to find.
- Hard code has more defects: The more complex the code gets the more defects you should expect to find.
- The more defects the better: If more defects are found in development and in review, then less defects make it to the customer.
Code Review Management
- If quantity of defects is used in performance evaluations, developers do not have incentive to open defects.
- You must have a quantifiable measure of success or else you cannot know if your review process is making a difference.
Review Best Practices
- The longer you take in review, the more defects you’ll find: this tops out at the hour and a half mark, and one hour is the optimal amount of time.
- Inspection meetings need not be in person to be effective.
- Review code in small batches: Anything below 200 lines produces a relatively high rate of defects, often several times the average.
- A reviewer will be unable to review more than 300-400 lines of code before they experience a performance drop.
- Large gatherings of multiple developers are no more effective than one-on-one reviews. In fact, in certain circumstances it is far less effective.
Interesting Facts
- A cost or ROI can be attached to code review.
- In one case a software company measured the reduced calls to customer support as their code review ROI. Over a few years they reduced their support calls from 50,000 to 20,000 per year even with a 2-fold increase in sales. Their estimated savings was $2.6 million dollars.
If you like what you read here, go order the book it’s free, seriously who doesn’t like a free book? You don’t even have to pay for shipping! Why haven’t you ordered yet?