Settings

Theme

I never delete code - only comment them

visualstudiomagazine.com

8 points by perivamsi 15 years ago · 5 comments

Reader

goo 15 years ago

This is f-ing terrible. Put your code into version control and stop having it be bad, for goodness sake.

ivank 15 years ago

I've seen one reason to keep old code in: if the new implementation is complicated and the old one is short and simple, keep the old one as documentation for how the new one essentially works.

  • anthonyb 15 years ago

    This is exactly what I do when writing complex code, and is about the only reason that I can think of to comment out code like this. The other time that I might do it is when I'm trying a couple of implementations to see which one is better.

    But leaving commented out code in there is just asking for trouble. What happens when someone comments it back in 6 months later?

teyc 15 years ago

There are times when this is required. For instance, where I find there is a line of code that shouldn't be called. Commenting it out and explaining that it breaks so and so is preferable to deleting it all together because there is a risk another developer will make the same error too.

headShrinker 15 years ago

Sorry I don't agree with this. I delete code all the time. The difference is, when I write elegant code that I am proud of I save it. The majority of code I write is utility not elegant by comparison. This is like my art, or any art.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection