I know that there are numerous blog posts already written about this topic, but I just can't resist. I've just had it with commented-out code. Sure, everybody agrees that this is evil in it's purest form, but why do I still have to endure so much commented-out code. It's bad for my heart.
Don't trust the source-control system? Get rid of it and replace is with a more reliable source-control system then. Check in more often! Feeling guilty about throwing away code? Too bad, go see a shrink or something. Keep your code clean at all times!
To me, a piece of code that contains commented-out lines is just another piece of crap. Most developers tend to just remove the commented-out lines and get on with it. I'm a bit more radical about this. I tend to throw away the whole shebang, like a tumor that needs to be removed along with it's roots. That's right. I remove all of the surrounding code as well.
Writing software is an act of discipline. Commented-out code is like a broken window. It introduces rot into a software system.
What triggered me to write this blog post besides the fact that I just can't stand commented-out code and have to see so much of it? Well, I was reading the foreword of the book Clean Code which mentioned this again (and also chapter 4). Why does this need to be written down again and again (including this blog post, I know, I know)? It's like periodically publishing articles in the newspapers that leaving dead bodies laying around is on the street is a bad thing. Isn't this just common sense? Not in this industry.
Glad that I've got this from my chest. Again.
Jan, the relieved