On huge legacy applications it is fairly common to see change in business rules leading to unused code. Is the deleting the best way? or Are there any standards of marking the unused code? SCM does help to get the old code back if needed. Also this is specific to .NET code bases.
Deleting dead code is not a technical problem; it is a problem of mindset and culture. There is often the sense that if code is not doing anything, it has no effect, so it's OK to leave it. It is worth keeping in mind that exactly the same reasoning also allows us to remove it: if it's not doing anything, remove it.
To find unused members with a Code Analysis Ruleset, from the Visual Studio menu select File -> New -> File… -> General -> Code Analysis Rule Set. Uncheck all the rules. There are many rules we don't care about right now – and some we probably won't ever care about.
This way you don't surprise your teammates too badly if you need to deprecate some code that you're assigned to but which they need to make calls to. But allows you to make those needed changes!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With