Defect Indicators: Code has been made unreachable, for example by:
- turning it into a comment or remark,
- placing a return statement above the code, causing the routine to exit without executing the code, and there is no comment explaining why.
- If the code should not have been disabled and is required in production, the problem may be found during testing and need to be fixed, or it may be found after the program goes into production, with unforeseen consequences, such as a crash or malfunction.
- If the code is commented out because the programmer thinks it may be needed in future, another programmer may notice the code and remove it because he is not aware of the programmer’s intentions.
- If the code is actually not required, a maintenance programmer may waste time later figuring this out.
- Mark all of the disabled lines of code.
- Determine if the code is required now, later, or not at all:
- If now, enable it.
- If later, write a comment to record your decision and the date that you made it.
- Otherwise remove the “dead” code.