TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Dead Code Is a Liability

3 pointsby devrobabout 2 years ago

2 comments

warrenmabout 2 years ago
&gt;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.<p>I <i>generally</i> agree with this sentiment ... but while a <i>likely</i> good rule-of-thumb, you also have to know when it&#x27;s <i>NOT</i> good to apply<p>If you have version control, it&#x27;s almost always correct - delete away, and revert if you need to<p>But when you <i>don&#x27;t</i> ... commenting-out (and dating when it was commented) ends up serving <i>as</i> a [very] poor man&#x27;s version control<p>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 <i>NO</i> concept of version control anywhere ... and the add-ons that attempt it do it very poorly
评论 #35073994 未加载
andrewfromxabout 2 years ago
Yeah 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&#x27;t mess anything up. If you have that 100% feeling it means you understand the entire codebase.
评论 #35054776 未加载