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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Delete your code

27 点作者 antonpirker大约 11 年前

9 条评论

morgante大约 11 年前
Strongly disagree with simultaneously deleting branches <i>and</i> commented out code.<p>We can (and should) safely delete commented code <i>because</i> we have branches which track the evolution of features and random experiments that might someday be useful. So long as the branches exist, we can always recover that code we just deleted.<p>But there&#x27;s not value in deleting old branches. They represent the history of a project&#x27;s development and should be respected as such.
评论 #7514482 未加载
评论 #7514440 未加载
评论 #7514549 未加载
评论 #7514574 未加载
danieltillett大约 11 年前
There is some value to leaving in commented out code when you change code from something that is simple to understand to something written for efficiency. In one of my projects I have a few functions that account for most of the runtime. The original functions were easy to understand, but slow. I rewrote them using a whole series of complicated code that even I forget what it is supposed to do. It really helps me to look at the original functions to know what the hell I was tying to achieve - basically I am using simple code to document wtf code.
评论 #7514499 未加载
评论 #7514483 未加载
评论 #7514453 未加载
deevus大约 11 年前
Some many times this. I absolutely hate seeing commented out code. There&#x27;s a reason we use source control.<p>If a developer doesn&#x27;t want to lose code they&#x27;ve deleted they can tag the revision in their repo so they can always get back to it quickly if needed.
评论 #7514353 未加载
JacksonGariety大约 11 年前
The better I get at programming, the more I realize that it&#x27;s all about the balance between trimming messy code and avoiding premature optimization.
joosters大约 11 年前
<i>Your massive test suite will tell you if you broke something. You have a massive test suite, haven&#x27;t you?</i><p>No!<p>Your test suite is meant to be a last safety net, there to catch you if you make a mistake. It&#x27;s <i>never</i> something to rely upon. Your tests will never be comprehensive enough. Adopting a &#x27;if the tests pass, all is OK&#x27; attitude, as implied by the article, is a terrible mistake.
评论 #7514559 未加载
optimusclimb大约 11 年前
This was documented 15 years ago, see:<p><a href="http://www.antipatterns.com/lavaflow.htm" rel="nofollow">http:&#x2F;&#x2F;www.antipatterns.com&#x2F;lavaflow.htm</a>
评论 #7514404 未加载
jon2512chua大约 11 年前
Good read. But regarding deleting commented out code, I have always have a strong aversion to doing so even though I really want to, for fear that someone somewhere might want it.<p>Has anyone ever faced this dilemma before? If yes how did you guys dealt with it?
评论 #7514306 未加载
评论 #7514313 未加载
评论 #7514321 未加载
评论 #7514407 未加载
评论 #7514315 未加载
评论 #7514630 未加载
评论 #7514355 未加载
ASneakyFox大约 11 年前
If you use an ide it will tell you if a function is being used in the project or not.
mantrax4大约 11 年前
I find the cognitive dissonance of talking how every line of code is a burden, yet talking about you needing a &quot;massive test suite&quot; entertaining.<p>That test suite is also code. How about we go delete some stuff there?
评论 #7514490 未加载
评论 #7514576 未加载