Академический Документы
Профессиональный Документы
Культура Документы
Code inspection is a powerful technique that identifies code defects early in the development cycle when they are inexpensive to remove. Nonetheless, many development teams avoid code inspection because of the overhead involved in review meetings and defect tracking. Learn a rapid code inspection method that leverages collaborative technologies to glean maximum benefit at a minimum time investment.
Executive Summary
Code inspection is the peer review of proposed code for the purpose of identifying defects. Although this review can identify defects early in the development cycle when they are inexpensive to remove, many development teams do not practice it because of the time consuming nature of traditional code inspection. The rapid code inspection method described in this research note provides the benefits of traditional code inspection with a substantially lower time investment. This note covers the following topics: Cultivating a code-review culture. Using a style guide. Developing inspector and author checklists. Preparing for inspection with bench checks and annotations. Submitting the optimal amount of code and reviewing for the optimal time period. Using a central repository to track defects. Holding reply meetings. Verifying that defects are fixed.
Learn a rapid code inspection method that can be adapted by any team for a variety of development methods.
2 www.infotech.com
Implementation Point
A recent review of 68 studies on the economics of defect detection found that the earlier in the development cycle a defect is detected, the less time consuming and costly it is to remove (see Figure 1).
Requirements Design Phase Discovered Coding Unit Test Integration Test System Test 0
Hours to Remove
Code inspection the peer review of proposed code for the purpose of identifying defects is a powerful technique for removing code defects early in the development cycle when they are inexpensive to remove. In addition to providing cost-effective defect removal, code inspection facilitates knowledge transfer, provides informal training, and encourages developers to write the best code they can because they know it will be inspected.
3 www.infotech.com
Key Considerations
Given the benefits, why dont all development teams inspect their code? The reasons can be grouped into two main categories: Psychological barriers. Human beings dont generally ask to be criticized, and pointing out code defects can feel like criticism. In extreme cases, poorly delivered feedback can create conflict in the team that leads to hurt feelings and impairs productivity. One response is to avoid code inspections. A more constructive response is to overcome psychological barriers by fostering a code-review culture. Practical barriers. A formal Fagan inspection requires a review meeting that takes time to organize (schedule, distribute code, etc.) and implement (carry out the meeting). A typical Fagan inspection takes nine person-hours per 200 lines of code reviewed. Although Fagan inspections demonstrate good ROI (for example, Hewlett-Packard accomplished a 10:1 ROI), the time required can make them difficult to implement for groups following an agile development process or those pressured to deliver as soon as possible. While some of these nine hours are consumed in the actual inspection of code, some of them are non-productive overhead that can be reduced by either eliminating or restructuring the review meeting.
Although the methods above are not optimal, the rapid code inspection process described in the next section can provide most of the value of the full Fagan inspection in a significantly reduced time frame.
4 www.infotech.com
5 www.infotech.com
6. Use a central repository to track defects. One major time sink with traditional code reviews involves consolidating the comments received from reviewers (often on paper). By using a single server-based document into which all reviewers enter their comments, teams can eliminate consolidation time and share comments between reviewers without holding a meeting. One reviewers comments help another reviewer to find additional defects, a process called phantom inspection in a traditional code review. A version-controlled spreadsheet posted to a server or Google Docs spreadsheet will do the trick for a small team. For an example of one, refer to the ITA Premium download, Code Inspection Tracker. For larger teams, consider collaborative code review software that not only supports defect tracking but also provides a host of comment routing and defect metric tracking features. Some examples include Smart Bear Softwares Code Collaborator and Atlassians Crucible. 7. Hold a reply meeting (optional). In a reply meeting, each author responds to the comments logged by reviewers. Authors can either accept that the defect needs to be corrected or defend its current implementation. Typically, the entire teams code can be replied to in a short meeting. The reply meeting facilitates communication between developers and provides a deadline by which reviewers must complete their inspection. However, in organizations where scheduling a reply meeting is difficult, it can be omitted and the replies entered into the central repository. 8. Verify that defects are fixed. To ensure that no defects fall through the inspection cracks, make someone responsible to verify that defects have been fixed. That person could be the team lead or the reviewer that discovered the defect.
Bottom Line
Code inspection is a powerful technique for identifying code defects early in the development cycle when they are inexpensive to remove. However, many development teams avoid code inspection because of the overhead involved in review meetings and defect tracking. Learn a rapid code inspection method that leverages collaborative technologies to glean maximum benefit at a minimum time investment.
Info-Tech's products and services combine actionable insight and relevant advice with ready-to-use tools and templates that cover the full spectrum of IT concerns. Our practical approach is designed to have a clear and measurable positive impact on your organization's bottom line. We serve over 21,000 clients at 8,000 organizations around the world. Since 1998, we have focused on making the work of IT professionals easier - and on helping them achieve greater personal and corporate success. More About Info-Tech
6 www.infotech.com