If you're one of the guilty parties who leave dead, commented-out code in the code base please stop.
Seven reasons to delete dead code:
- It's dead.
- The dead code is only valid/useful in it's original context and as the code continues to change that context will quickly disappear.
- It's in source control history anyway (in it's original context). You are using source control aren't you?
- When you checked in your changes to source control you should have noted in the comments box that you deleted the code and why (assuming the deleted code was important).
- In the future neither you nor anyone else could really trust that the code is valid even if it does need to be put back in place; it's probably just as fast to rewrite it as to validate it.
- If people do need similar functionality they might be tempted to use the commented code as a crutch without really understanding what it does, and when they do really bad things will happen.
- The code will stay there... forever. No one else will delete because they won't know why it was removed and they'll be afraid it contains some magic bullet that may be needed sometime in the future (after all it must have been left there for a reason). In three months even you won't remember why you removed it, your comments will seem unclear and you won't delete it either because you'll be just as afraid as everyone else.
And don't cheat and check in 60 files at once and put "updated for ticket 0974". Though this is better than nothing, in most cases checking in each file individually and commenting on that file in the context of the ticket is much more useful e.g. "ticket 0974: added a link to header menu to point to the new analysis engine (only available for administrative role); fixed menu formatting problem; removed commented, dead code from my previous changes.". Now if someone reviews you're changes they can look at your comments, do a file compare to the previous version and understand exactly what you changed and why.