|
|
|
|
|
|
|
|
|
MSF for CMMI Process Improvement > Wiki Pages > Activity - Refactor Code for Bug Fix
|
Activity - Refactor Code for Bug Fix
|
|
|
|
|
|
Activity Information Refactor Code for Bug Fix
DescriptionCode is refactored after a code review has determined that changes need to be made to address code quality, performance, or architecture. To refactor code, complete one change at a time in accordance with the code review work item, and perform unit tests after each change. This approach minimizes potential code breakage. Use automated refactoring whenever possible as the automated processes are less likely to cause functionality to break. Attributes| Element Categories | [CMMI Track 3] Build, [CMMI Track 4] Stabilize, [CMMI Level 3] TS SP 3.1, [CMMI Cycle 6] As Needed | | Guidance | Refactoring C# | | Entry Criteria | Unit tests for the code area are up-to-date and run successfully: Unit tests for the code area are up-to-date and run successfully.
Source code to be refactored is available locally or for check out: Source code to be refactored is available locally or for check out.
Code review meeting work item is created: Code review meeting work item is created. | | Exit Criteria | Refactored source code: Refactored source code. | | Is Required | Yes |
StepsRead Code Review Notes:
Read the code review work item notes to determine how you will refactor the code.
If the code review notes indicate that the code was "Accepted with Changes," plan to refactor the code and then perform the "Integrate Changes" activity as the next step.
If the code review notes indicate that the code was "Rejected," plan to refactor the code and then repeat the "Prepare for Code Review" and "Code Review" activities. Apply Refactoring:
Apply the refactoring incrementally, one change at a time. Change the code and all the references to the modified area as necessary.
If a class does not map to an abstraction of a real world or programmatic element, rename the class to a name that maps appropriately. Change all of the references to the code.
If methods are too complex, it may be necessary to break a method up into a set of new methods. Use "extract method" to pull out functionality that belongs in its own method. Be sure the new method is consistent with the abstraction (class name) in which it is added. Perform Unit Tests:
Perform unit tests so the area remains semantically equivalent after the refactoring. Fix any nonworking unit tests.
Perform code analysis and fix any warnings.
Perform unit tests again if code changes are made as a result of code analysis.
|
Last modified at 12/19/2007 10:37 AM by Administrator
|
|
|
|
 |
 |
 |
 |
|