7 ms·
Good read. But regarding deleting commented out code, I have always have a strong aversion to doing so even though I really want to, for fear that someone somew
by jon2512chua 12y ago
Good read. But regarding deleting commented out code, I have always have a strong aversion to doing so even though I really want to, for fear that someone somewhere might want it.
Has anyone ever faced this dilemma before? If yes how did you guys dealt with it?
- antonpirker 12y agoI always think: the code can be found in the repository somewhere. So if we need it later, we still have it. But in the production the commented out code it is just confusing.
- chill1 12y agoI agree with antonpirker here. As long as you're using a version control system, the code isn't lost. Delete the commented out code, and leave a helpful commit message along with the deletion. That way the deleted code can be found, if really necessary.
- jon2512chua 12y agoMajor do'h moment for me. :P Got so used to using a VCS that I took some things for granted.
- diggan 12y agoYes, I had the same issue and commented out the code instead of deleting it. Then I started using Git, started deleting the code instead and have never looked back.
- jdpage 12y agoAre you using a version control system? Of course you are. This means that you can (relatively) safely delete anything you want in the working directory, because you can go back and retrieve older versions from the VCS.
- deleted 12y ago[deleted]
- danieltillett 12y agoI keep the code if it helps me understand the code that remains. I always try to write code that is simple, but sometimes other consideration (speed) mean that I have to turn easy to understand code into something that is not. Keeping the original code can help me understand what the new code is supposed to be doing.
- collyw 12y agoIf I have stuff like that, I often add a date to the comment. If its not been used in 6 months and i see it again, I'll usually delete.