TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Dead Code Is a Liability

3 点作者 devrob大约 2 年前

2 条评论

warrenm大约 2 年前
&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 未加载
andrewfromx大约 2 年前
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 未加载