Now that I use the Delete Key…


Some Quick Background

I have the longest tenure on our team, and it’s not that long; there was a bit of an exodus just prior to me joining. I was with a small contract team and none of us knew the code when we were thrown into the situation. Needless to say, since I’ve been there the longest, I have the most experience with the code. Source control management was handled by Visual Source Safe 6.0 and there was little documentation. Most of the documentation was in comments in the code, usually followed by code that was commented out. Without the confidence of tools to ensure that our production code was actually the code in VSS (no common build process or automation). We were afraid of our code.

Moving On

Since then, we’ve switched to Subversion, we have an automated test suite, and continuous integration. I no longer have a fear of deleting code that is commented out. We do a fairly good job of not letting this even get into the source code repository, but you’ll find it from time to time. Our code review process is getting better each day and test coverage continues to rise.

As the post reads, I use the delete key without fear now. Code that is committed has comments tied to the revision, it has been reviewed and has tests around it. There is no need for code to be commented out, it only confuses matters, I delete it when I see it, and it’s a good feeling to be able to do so. I don’t think we’re that mature of a team, since I still get excited about unit test numbers, but this is a really good step to be in, compared to where we used to be.

Even Better! (A Side Note)

Not only have I been more apt to delete code that is commented, I’m also more likely to delete entire methods, classes and interfaces. This is largely due to the fact that our entire team has a copy of ReSharper by JetBrains. Tools only get you so far, but they can be helpful in reducing the time it takes to get something done. ReSharper is great for refactoring enforcing some best practices like removing un-used code.

Anti-Patterns and Worst Practices – Utils Class