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.

Delete your code

27 pointsby antonpirkerabout 11 years ago

9 comments

morganteabout 11 years ago
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 未加载
danieltillettabout 11 years ago
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 未加载
deevusabout 11 years ago
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 未加载
JacksonGarietyabout 11 years ago
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.
joostersabout 11 years ago
<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 未加载
optimusclimbabout 11 years ago
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 未加载
jon2512chuaabout 11 years ago
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 未加载
ASneakyFoxabout 11 years ago
If you use an ide it will tell you if a function is being used in the project or not.
mantrax4about 11 years ago
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 未加载