Code Review for Solo Programmers
If you write most of your software alone, like I do, you have this problem. There’s no one to review your code.
Actually, there is. I learned about them from a discussion on the Madison Area Software Developers’ Meetup mailing list.
- ReviewMyCode on Reddit; code itself should go on https://gists.github.com, “a place for sharing snippets and pastes.”
- I know and use StackOverflow, but my how it’s grown! There are now 92 member sites of StackExchange, including codereview.stackexchange.com.
You can also get code reviewed on Experts-Exchange.com. A subscription is $12.95/month. It’s not so good for browsing through code to help learn, because the code reviews are by technology, and are listed under the specific question rather than lumped all together. But EE has been a good place to get answers to technology questions in general, especially because it’s moderated well, and questioners have to tell which solution actually worked.
A few thoughts on code reviews in general:
- For maximum effectiveness, use two or three reviewers. The second reviewer will spot half again as many issues; it’s amazing. The added impact of more than three isn’t worth the added time.
- Don’t try to review too much in one session. Sessions should go no longer than an hour—two at the outside. That includes both individuals reading code and the review read-out meeting itself.
- Require reviewers to go through the code by themselves, in advance. Use a consistently line-numbered version to make it easy to log issues and merge them up later.
- Over time, you’ll establish a metric of how much code can be reviewed in an hour or two, making it easier to chunk it.
- The meeting should be solely to read out issues. Reviewers should have already reviewed the code and made their list of issues. How to resolve issues is up to the author’s discretion, but should happen apart from the meeting. “Committee of the whole” problem-solving is highly tempting & wasteful.
- If the author feels “on the spot” leading the actual walk through the code, it’s OK for someone else to do it. Just make sure it’s clear that there’s someone recording issues and merging duplicates as they’re read out, and that it isn’t the author. They need to be able to listen and ask & answer brief, clarifying questions related to the issue itself—not the solution.
- Guard the review scope zealously. If the review surfaces broader design or architecture issues, set up another round of review.
You can review any kind of document this way, not just code. It seems time-consuming, but in terms of defects detected and resolved per hour, it blows away any other QA method I’ve ever seen, especially manual-test-and-fix. I didn’t invent this. It’s called Gilb Inspection. I’m sure they’ve done more with it since I was trained on and used it a dozen years ago.
We had testers complaining of boredom.