Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Absolutely. Your code is a delusion. You think it does one thing. It does another. Do not care about what the code actually is. Care about what it does. If the code does not meet your needs, then the code is dead (long live the code). Delete it without fear.

It's one thing that drives me nuts about working on teams: coming in to a version-controlled section of code that has had bug fix work done on it with large sections of old code commented out. "This didn't work, so here is the new stuff." So why keep the old stuff? "Well, I was worried I'd forget XYZ". Then address it when you find it. Throw away that old code.

I would even go so far as to say that out-of-version-controlled code should be discarded with great haste. If you can't rewrite the code from scratch, then you don't understand it. Code lies, cheats, and steals. How do I know it's the code that is at fault? Because it's not the person, and people have needs, and those needs still need to be filled, regardless of whether or not the code does what it says it does.



I often leave in old code that does not work because of an API issue, along with the API issue. Something like

/* the above is a workaround; Unfortunately _code_ causes a segfault due to bug 123 see:... */




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: