Annual Review of Commented Code Relic
The code is commented out. It has been commented out since March. A comment says 'old implementation - might need this.' It might not. It has not been needed.
Year in review: commented code. Period: The past year. Commented blocks identified at year start: fourteen. Removed during the year: seven. Remaining at year end: seven. Oldest: fifteen months.
The Retention Logic
Commenting out code rather than deleting it is a form of temporary retention. The comment preserves the previous approach while the new one is tested. If the new approach fails, the commented code can be uncommented.
This logic is sound for the first two weeks of the new approach's existence. After two weeks, the new approach is validated or rejected. If validated, the old approach is no longer needed. If rejected, the new approach would have been replaced.
The Fifteen-Month Case
The code commented out in March 2024 has survived:
- Five feature deployments to production.
- One major refactor of the surrounding code.
- Three developers reviewing the file for related work.
- Two code review sessions that included this file.
None of these events produced a decision to delete it. The comment says "keep for now." Now has been redefined fifteen times since March 2024.
The Version History Argument
The code is in version history. Any git command can retrieve it. Deleting it from the active file does not destroy it. It can be accessed from the commit where it last existed.
This argument has been made internally on five occasions. It has not produced a deletion.
The Recommendation
Delete the seven remaining blocks. They are in version history. They are not needed. Their presence adds visual noise and creates a question every time a new developer sees them.
The recommendation has been available since April 2024. The code is still there.