At my company we define the following roles for a code review meeting:
- Moderator - he/she is responsible for making sure that the code review meeting is effective and focused on the goals.
- Author - The developer that wrote the module/code that is being reviewed;
- Reviewer - One or more developers that review the module.
The minimum number of persons for an effective code review is at least 3. The obvious author, a moderator and at least one reviewer. This widens the probabilities of potential bugs being found.
The formal process is the following:
- Developer creates the code
Developer creates a DRR - Document Review Report - where it states the code that is being reviewed.
- The classes and CVS revisions that are being reviewed;
- The roles for the code review and the persons assigned to each role;
- The CVS tag that marks the code being reviewed on the source control system.
- The CVS tag that will mark the code after modifications resulted from code review are applied by the author.
Code review meeting is scheduled by author.
- Code review meeting is done. The defects found are recorded in the DRR.
- The author corrects the defects and signs the DRR saying that the modification has been done.
- The author tags the CVS system with the code review output tag declared in the DRR.
- The author hands the DRR to the moderator.
- The moderator checks if the modifications have been done and can be found on the source control system.
- The moderator signs the DRR saying that the modification has been confirmed.
- The moderator hands over the DRR to the quality department for archiving. If no quality department is in place the project manager should save a hardcopy of the DRR on the project folder.
Example:
Developer John Doe creates a Math class that adds two numbers. He does his best to put some bugs to test the code review process.
public static class MyMath {
public static int Add(int a, int b) {
return a - b;
}
}
He puts his code in the source control system and the class MyMath.cs gets revision 1.1.
Then he goes to write the DRR - Document Review Report.
Modules/Classes
MyMath.cs myproject/implementation/common/MyMath.cs (1.1)
Roles
Moderator - Jill Goner [email protected]
Author - John Doe [email protected]
Reviewer #1 - Matt Groening [email protected]
Tags
Input - PROJECT_0_0_1_INPUT_REVIEW
Output - PROJECT_0_0_2_OUTPUT_REVIEW
John Doe tags the current MyMath.cs revision 1.1 with the tag PROJECT_0_0_1_INPUT_REVIEW on the source control system.
John Doe schedules the meeting.
The meeting takes place and the defects are marked on the DRR. The total count of defects is also included.
John Doe goes and makes the changes on the source code and commit the modified revision to the source control system.
John Doe applies the output review tag PROJECT_0_0_2_OUTPUT_REVIEW.
John Doe signs the DRR and gives it to the moderator Jill Goner.
Jill Goner goes ahead and checks that the modifications were done and that the output tag was created.
Jill Goner signs the DRR and hands it over to the SQA (Software Quality Assurance) engineer.
Aside hint - Keep code reviews under a 2 hour maximum length. Humans tend to oversee important things mostly when reviewing code when the code reviews sessions are lengthy. It is better to split a review among more sessions that try to do it all at once.