Essay 5Throw Away Your Old Code

Recently, one of my colleagues, Mustafa, mentioned that I was “doing it again.” I was code hoarding: commenting out code that I wasn’t really planning on ever using again. I just didn’t have the heart to delete it right then, even though we version control all of our source code (and you absolutely should be doing the same). Since I could always get that old code back anyway, there was no reason to be commenting out code when I could just delete it.

Code hoarding is one of many habits that seems right on the surface. It’s a carryover from other staple engineering principles that aren’t really relevant to programming. If we were building a car, we would probably save all our scrap metal because we could reuse ...

Get The Developer's Code now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.