I think it takes both courage and self control for a developer to simply delete code.
Usually, developers prefer to comment out code rather than delete it. I see this a lot, both while pair programming and while reading other people's code.
I have nothing against comments per se, or against commenting out code when you know you're going to need it a bit later. What ticks me off is when I devs comment out a whole block of code because they're about to rewrite it. And then they just leave it there. Forever.
That's a problem because when someone else comes in and reads the codebase, they see the comments and they have to read those too. Because, hey, if the commented code would be useless, then it would have been deleted, right? Therefore, this code is just as valuable and important as the uncommented code.
Another scenario occurs with shotgun coders. You know them and you've worked with them. They don't really know the API so the hack at the examples and you could swear that you can read their thoughs when you watch them try out different API calls: "Maybe this will work." -- "OK, maybe this?" -- "This?"
They comment out each try, leaving a trail of failed trials in their wake. And when -- as if by miracle -- they do get the damn thing working, they quickly close the file. Yes, comments left untouched. Like a trophy of cool code and of their great effort.
It takes courage to delete code, it seems. You first need to understand what the code you're deleting is doing. People don't like to invest time in that kind of stuff. They'd much rather have the old code right there in case they screw up.
Deleting code is like making a promise. You give your word that you are going to write better code that will replace and maybe extend the old one. This means the old code will be obsolete. And in the words of the late George Carlin, here's what I like to do with obsolete code: delete the fuck! I do have git to take care of old versions of the codebase so I don't have to, right?
The next time you comment out some code trying to fix a bug, remember that and delete it when you're done.