6 ms·
Dead Code Is a Liability
- andrewfromx 4y agoYeah there is risk in taking out a janga piece and the whole tower falls! I actually love removing tons of code and being 100% sure I didn't mess anything up. If you have that 100% feeling it means you understand the entire codebase.
- warrenm 4y ago>If you have that 100% feeling it means you understand the entire codebase. ...or you're overconfident, and understand it far less than you think :) (not that I ever did something like that when I used to program...)
- warrenm 4y ago>In my pull request, I had noted that a given test suite and the associated code weren’t actually used and working and so I was commenting them out. At the time, he told me to delete the lines instead of commenting them out; citing that “dead code” (e.g., unused, unexercised or otherwise unneeded code) served as a greater liability than source of future implementation and re-use. I generally agree with this sentiment ... but while a likely good rule-of-thumb, you also have to know when it's NOT good to apply If you have version control, it's almost always correct - delete away, and revert if you need to But when you don't ... commenting-out (and dating when it was commented) ends up serving as a [very] poor man's version control I end up having to do this (or make copies and only work on the copy) with the product I use most for work because it has NO concept of version control anywhere ... and the add-ons that attempt it do it very poorly
- devrob 4y agoYes completely agree, I should update the post to account for the assumption of version control (thanks!)