Devlico.Us
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @devlicious

Derik Whittaker

Thoughts on Software Development, .Net, OOP, Design Patterns and all things cool



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,



Comments

Dave Donaldson said:

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

# November 14, 2007 7:23 PM

Chinh Do said:

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.

# November 14, 2007 9:18 PM

Damien Guard said:

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

[)amien

# November 15, 2007 2:51 AM

Finds of the Week - Nov 16, 2007 » Chinh Do said:

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

# November 16, 2007 9:50 PM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add

About Derik Whittaker

Derik is a .Net Developer/Architect specializing in WinForms working out the northern suburbs of Chicago. He is also believer and advocate for Agile development including SCRUM, TDD, CI, etc.

When Derik is not writing code he can be found spending time with his wife and young son, climbing on his bouldering wall, watching sports (mostly baseball), and generally vegging out. Check out Devlicio.us!

Our Sponsors

Red-Gate!