CODE REVIEWS Assignment Each team should perform a

  • Slides: 11
Download presentation
CODE REVIEWS � Assignment � Each team should perform a code review � Select

CODE REVIEWS � Assignment � Each team should perform a code review � Select a section of code � Select � Other your more difficult code sections. members of the team and the instructor will be given copies of the code to review at least 48 hours ahead of time. � The code review should last about 1 hour. � Don’t select too much code – about 300 lines is good

CODE REVIEWS OBJECTIVES � Find bugs in the least costly manner � Ensure that

CODE REVIEWS OBJECTIVES � Find bugs in the least costly manner � Ensure that coding standards are maintained � Train staff and disseminate knowledge of system implementation � Make sure code is readable and maintainable

FORMAL INSPECTION � All participants are given copies of the code to be reviewed

FORMAL INSPECTION � All participants are given copies of the code to be reviewed before the review (usually a couple of days ahead of time) � The reviewers review the code before the meeting � The code author and other team members gather to review the code � The principal goal is to find bugs (defects), not fix them

FORMAL INSPECTIONS ROLES � Moderator � Sets the pace � Arranges meeting and manages

FORMAL INSPECTIONS ROLES � Moderator � Sets the pace � Arranges meeting and manages materials � Reports Results � Follows up � Author � Answers questions � Explains things that are unclear (and will obviously have to be changed. )

FORMAL INSPECTION ROLES CONTINUED � Reviewer � Fellow programmer � Tester � High-level architect

FORMAL INSPECTION ROLES CONTINUED � Reviewer � Fellow programmer � Tester � High-level architect � Scribe � Records problems (the official record of the review) � Records action items � Management meeting must be excluded from the

HOW MUCH CODE SHOULD BE REVIEWED IN ONE MEETING? � Enough to consume about

HOW MUCH CODE SHOULD BE REVIEWED IN ONE MEETING? � Enough to consume about an hour’s time � Number of lines of code varies significantly with code complexity

INSPECTION MEETING � Someone other than the moderator or author reads or paraphrases the

INSPECTION MEETING � Someone other than the moderator or author reads or paraphrases the code � Reviewers make relevant comments as the code is read � Remember you are looking for bugs � Address the code – not the programmer � (“The code does” … rather than “You did…”) � “Egoless” is the goal, but seldom the reality � Reviewers don’t recommend fixes

INSPECTION REPORT � Issued within 24 hours of the meeting � Report is a

INSPECTION REPORT � Issued within 24 hours of the meeting � Report is a record of what was found � “What was found” provides statistics for management on efficacy � What was found provides opportunity for followup

REWORKS AND FOLLOW-UP � Rework � The author fixes the defects � Follow-up �

REWORKS AND FOLLOW-UP � Rework � The author fixes the defects � Follow-up � The moderator is responsible for seeing that the defects have been addressed, but it is up to the author to make decisions about what needs to be changed. � Review the code again � Review relevant sections only � No formal review

THIRD-HOUR MEETING � Optional informal meeting in which reviewers discuss solutions. This meeting should

THIRD-HOUR MEETING � Optional informal meeting in which reviewers discuss solutions. This meeting should only be held if the author requests it, or if there are significant urgent problems.

ALTERNATIVES � Over-the-shoulder Reviews Author walks through code with one peer � Less formal

ALTERNATIVES � Over-the-shoulder Reviews Author walks through code with one peer � Less formal � � Less documentation/assurance of completion � No formal followup � Email (pass-around) reviews Not constrained to place/time � Can be difficult to track the conversation � � Pair-Programming Pairs can be too close to the code to see problems � May be more time-consuming/expensive � Can be combined with formal reviews �