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.

Related:

Post Footer automatically generated by Add Post Footer Plugin for wordpress.

About Chris Missal

Oh hey, I'm a Senior Consultant for Headspring in Austin, TX. I've been working in software professionally since 2006 and I really, really love it. I'm mostly in the Microsoft world, but enjoy building computer things of all sorts (to be vague). When I'm not slinging code, I'm probably out and about slinging discs, bowling balls, or good beer with great friends.
This entry was posted in Best Practices, Development, Legacy Code. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • http://timbarcz.devlicio.us Tim Barcz

    Kind of liberating isn’t it? There’s something highly satisfying about a clean codebase. I don’t know how people live with large blocks of commented out code or unused classes in their code.

    What is harder yet to do is to delete some awesome piece of code because it is now obsolete…

  • http://blogs.imeta.co.uk/HHariri/archive/2008/08/27/dont-comment-code-out.aspx Hadi Hariri

    You would think it’s obvious, but I still run into commented out code.