Strongly disagree with simultaneously deleting branches <i>and</i> commented out code.<p>We can (and should) safely delete commented code <i>because</i> we have branches which track the evolution of features and random experiments that might someday be useful. So long as the branches exist, we can always recover that code we just deleted.<p>But there's not value in deleting old branches. They represent the history of a project's development and should be respected as such.
There is some value to leaving in commented out code when you change code from something that is simple to understand to something written for efficiency. In one of my projects I have a few functions that account for most of the runtime. The original functions were easy to understand, but slow. I rewrote them using a whole series of complicated code that even I forget what it is supposed to do. It really helps me to look at the original functions to know what the hell I was tying to achieve - basically I am using simple code to document wtf code.
Some many times this. I absolutely hate seeing commented out code. There's a reason we use source control.<p>If a developer doesn't want to lose code they've deleted they can tag the revision in their repo so they can always get back to it quickly if needed.
The better I get at programming, the more I realize that it's all about the balance between trimming messy code and avoiding premature optimization.
<i>Your massive test suite will tell you if you broke something. You have a massive test suite, haven't you?</i><p>No!<p>Your test suite is meant to be a last safety net, there to catch you if you make a mistake. It's <i>never</i> something to rely upon. Your tests will never be comprehensive enough. Adopting a 'if the tests pass, all is OK' attitude, as implied by the article, is a terrible mistake.
This was documented 15 years ago, see:<p><a href="http://www.antipatterns.com/lavaflow.htm" rel="nofollow">http://www.antipatterns.com/lavaflow.htm</a>
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.<p>Has anyone ever faced this dilemma before? If yes how did you guys dealt with it?
I find the cognitive dissonance of talking how every line of code is a burden, yet talking about you needing a "massive test suite" entertaining.<p>That test suite is also code. How about we go delete some stuff there?