Derik Whittaker



Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at
If the code is dead, then bury it

This post is just a quick rant, brain dump, food for thought or what ever.

If you ever need to make changes to existing code base, and you need to remove old code.  DELETE IT, don't EVER COMMENT IT OUT AND LEAVE IT FOR THE NEXT GUY (yes, I am trying to yell) 

I don't know how many times I stumble across dead, commented out code.  And every time I do, I wonder, is this code really needed?  Was it left here for a reason?  Should it be in use?

I know that when I do stumble across dead, unburied code, I bury it.  If at some point in the future that code is needed again, that is what source control is for.

This post may appear to be obvious to many, but I still come across this scenario all the time. 

Till next time,

Posted 11-14-2007 3:38 PM by Derik Whittaker
Filed under: , ,



Dave Donaldson wrote re: If the code is dead, then bury it
on 11-14-2007 7:23 PM

Amen brother. This is one of my biggest pet peeves and is a practice that just needs to go away.

Chinh Do wrote re: If the code is dead, then bury it
on 11-14-2007 9:18 PM

Sometimes if I want to keep the commented code around for a short while longer (just in case the new code doesn't work and I don't want to spend time going to the source control system), I will put a TODO comment next to it to tell myself to delete it later. If I forget to actually delete, the next guy should be able to see the TODO comment and know what to do with it.

Damien Guard wrote re: If the code is dead, then bury it
on 11-15-2007 2:51 AM

I can understand why people used to do but with source control it's totally unnecessary.


Finds of the Week - Nov 16, 2007 » Chinh Do wrote Finds of the Week - Nov 16, 2007 » Chinh Do
on 11-16-2007 9:50 PM

Pingback from  Finds of the Week - Nov 16, 2007 » Chinh Do

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Google Reader or Homepage Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of
Red-Gate Tools For SQL and .NET


SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
NHibernate Profiler
Balsamiq Mockups
JetBrains - ReSharper
Web Sequence Diagrams
Ducksboard<-- NEW Friend!


Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers


Community Server (Commercial Edition)