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.

-2000 Lines of Code

646 pointsby goranmoominabout 4 years ago

39 comments

dangabout 4 years ago
If curious, past threads:<p><i>-2000 Lines of Code</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=10734815" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=10734815</a> - Dec 2015 (131 comments)<p><i>-2000 lines of code</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7516671" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7516671</a> - April 2014 (139 comments)<p><i>-2000 Lines Of Code</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=4040082" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=4040082</a> - May 2012 (34 comments)<p><i>-2000 lines of code</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=1545452" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=1545452</a> - July 2010 (50 comments)<p><i>-2000 Lines Of Code</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=1114223" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=1114223</a> - Feb 2010 (39 comments)<p><i>-2000 Lines Of Code (metrics == bad) (1982)</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=1069066" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=1069066</a> - Jan 2010 (2 comments)
评论 #26390451 未加载
评论 #26391130 未加载
josalhorabout 4 years ago
Just the other day I was in my logistics class and the professor started deviating into something that I believe was pure nonsense.<p>He started the lecture by analyzing how many pieces a machine could manufacture per day. Fair enough. He extended the model to measure different ratios of capacity. Makes sense.<p>Then he tried to extend the model to all machines, including humans. His example was: &quot;How do you measure the capacity of a legal team?&quot;. I thought it was a trick question, so I answered (paraphrasing) &quot;You can&#x27;t answer that question the same way you answer for the machine. You can&#x27;t give a single metric.&quot; He told me I was wrong and that the _right_ measure would be (total number of working hours&#x2F;day).<p>I was tempted to try to convince him otherwise. The analogy was deeply flawed. He certainly measured the machines in (number of pieces &#x2F; day) but measured the legal team in (hours&#x2F;day). So, in analyzing a machine, you take into account its efficiency, but you don&#x27;t do the same thing for humans.<p>I believe that is exactly the same thing that is going on in the post. Managers&#x2F;Logistics&#x2F;Economists are very susceptible to this kind of generalization pitfalls.<p>Edit: Given that this answer has generated some discussion I feel the need to expand on it. The legal team was not expected to sell their services &quot;by the hour&quot;. In fact, any discussion about how their services were sold was shut down by the professor. From his point of view, the lawyers were machines and he was asking the question &quot;how much can this machine produce?&quot;<p>Yes, other students also suggested taking the number of billable hours&#x2F;revenue into account, but that&#x27;s not the answer the professor was looking for.<p>I don&#x27;t criticize whether his answer is not <i>technically</i> right, but I feel it holds no real-world meaning. It was a purely academic question that leads nowhere instead of having a debate about how you measure the productivity of a group of human beings. And on top of that, his final answer was definitive and (from his point of view) was irrefutable.
评论 #26390817 未加载
评论 #26390260 未加载
评论 #26389890 未加载
评论 #26388920 未加载
评论 #26388822 未加载
评论 #26390012 未加载
评论 #26393902 未加载
评论 #26396321 未加载
评论 #26391028 未加载
评论 #26388892 未加载
评论 #26392954 未加载
评论 #26396686 未加载
评论 #26393763 未加载
评论 #26389367 未加载
评论 #26388911 未加载
评论 #26389970 未加载
评论 #26397758 未加载
评论 #26391666 未加载
评论 #26400430 未加载
评论 #26388769 未加载
评论 #26396773 未加载
评论 #26393245 未加载
评论 #26390965 未加载
评论 #26390569 未加载
评论 #26389048 未加载
评论 #26390716 未加载
评论 #26391025 未加载
cbsksabout 4 years ago
One of my most proud accomplishments was reducing the size of a driver from ~3000 lines of code to ~800. The file was 15 years old and had been modified by many people since. There were conditionals that were impossible to hit, features that had been abandoned years ago, duplicate code, and lots of comments that didn’t match the code anymore. After my changes and a few new tests, the driver had full MCDC code coverage and the code actually matched the device specification!
评论 #26389159 未加载
评论 #26389711 未加载
评论 #26389387 未加载
评论 #26388973 未加载
评论 #26389467 未加载
评论 #26396717 未加载
beaconstudiosabout 4 years ago
This take is probably going to be controversial here, but I suspect that most metrics don&#x27;t accomplish anything beyond giving control freak managers a sense of control or insight.<p>Most complex processes can&#x27;t be reduced to a handful of simple variables - it&#x27;s oversimplification at its worst. The best you can do is use metrics for a jumping-off point for where something &#x2F;might&#x2F; be going wrong and thus start engaging with actual humans (or reading code&#x2F;logs&#x2F;some other source of feedback). Too often I&#x27;ve had to deal with management who go straight from metrics to decisions and end up making bad decisions (or wasting everyone&#x27;s time shuffling paper to generate good looking metrics).
评论 #26390687 未加载
评论 #26390890 未加载
评论 #26393110 未加载
评论 #26392029 未加载
评论 #26391098 未加载
评论 #26390762 未加载
评论 #26394963 未加载
评论 #26390707 未加载
评论 #26392863 未加载
everybodyknowsabout 4 years ago
The management psychology side of this wants a sequel from some veteran who was in the meetings and is now ready to confess:<p>&gt; ... wrote in the number: -2000.<p>&gt; I&#x27;m not sure how the managers reacted to that, but I do know that after a couple more weeks, they stopped asking <i>Bill</i> to fill out the form, and he gladly complied.<p><i>Bill</i> — but what about the rest of the team? The devil’s answer: They were expected to keep supplying the number, because line management was forwarding the stats up, having previously “sold” upper management on their value. And to admit error on such a fundamental is career-threatening.
khaledhabout 4 years ago
My favorite quote about this topic:<p><pre><code> Measuring programming progress by lines of code is like measuring aircraft building progress by weight. - Bill Gates </code></pre> My personal point of view is that: every line of code you write is a liability. Code is not an asset; a solved problem is.<p>Edit: To clarify, I&#x27;m definitely not encouraging writing &quot;clever&quot; short code. Always strive to write clear code. You write it once, but it will be read (and potentially changed) many, many times.
评论 #26389010 未加载
评论 #26389373 未加载
评论 #26389002 未加载
评论 #26389413 未加载
评论 #26389590 未加载
评论 #26390314 未加载
评论 #26389377 未加载
评论 #26389210 未加载
评论 #26389472 未加载
fredleyabout 4 years ago
I am a staunch code minimalist. Less code is (almost?) always better. The best, fastest, cleanest code is the code that doesn&#x27;t exist at all. Always aim to write the least code. Less code is less maintenance, it&#x27;s less to grok for the next person to read it.
评论 #26389062 未加载
评论 #26388461 未加载
评论 #26388805 未加载
评论 #26408054 未加载
评论 #26388958 未加载
Zelphyrabout 4 years ago
I had a manager once tell a co-worker (who is easily one of the best programmers I have ever worked with), &quot;There&#x27;s no way this can work. There&#x27;s not enough code.&quot;<p>Why we keep promoting these people into positions of management is beyond me.
meepmorpabout 4 years ago
There are some fascinating stories on the site, including some ones about Bill Atkinson (the programmer here) that really help to flesh out the sheer absurdity of asking him, in particular, to fill out a sheet like that. I believe he personally wrote something like 2&#x2F;3 of the original Macintosh ROM.<p>edit: here&#x27;s one that I find to be an interesting character study: <a href="https:&#x2F;&#x2F;www.folklore.org&#x2F;StoryView.py?story=Round_Rects_Are_Everywhere.txt" rel="nofollow">https:&#x2F;&#x2F;www.folklore.org&#x2F;StoryView.py?story=Round_Rects_Are_...</a>
Twirrimabout 4 years ago
Years ago I worked for an ISP &amp; managed hosting company as third line support. 1st and 2nd line support were pretty good, and would handle a lot of the cases that came through.<p>Generally by the time it&#x27;d reach us, it was something requiring more in depth troubleshooting.<p>They introduced a metric to measure ticket performance. The rough idea was &quot;faster it&#x27;s resolved, the better&quot; (reasonable measure, if you&#x27;re also tracking customer satisfaction), combined with &quot;fewer interactions with customer the better&quot; which was an absolutely stupid way to measure performance.<p>About a month after it came out, we were getting chewed out for our &quot;conversion score&quot; being low. Too many interactions with customers, and tickets taking a while to handle. No shit, we&#x27;re the top tier of support. If it got to us it was <i>bound</i> to take time to resolve, and almost certainly involved a lot of customer interaction.<p>One of the engineers in the team managed to dig up how to get a &quot;conversion&quot; rate report up for any support engineer, though not the code that generated the figures, and very quickly realised that the way to get 100% conversion rate was just to resolve and immediately re-open the ticket as soon as you picked it up. We all promptly started doing that, and they stopped chewing us out.<p>If you incentivise the wrong behaviour, you&#x27;re going to get results you likely don&#x27;t want.
评论 #26414896 未加载
mynameisashabout 4 years ago
&quot;It seems that perfection is attained not when there is nothing more to add, but when there is nothing more to remove.&quot; - Antoine de Saint Exupéry
noarchyabout 4 years ago
There are still companies trying to impose metrics on software development. It isn&#x27;t just lines of code, it may also include commits per day. And this isn&#x27;t even taking into account various &quot;Agile&quot;-related metrics, like story points per sprint and the like.<p>I wonder if we should name the companies who do this, or if it is fighting a losing battle? In the end, some management just wants to look at charts.
评论 #26389424 未加载
mshockwaveabout 4 years ago
It&#x27;s crazy that even in 2021, I know some of the teams are still measuring productivity by LOC _only_. People just never learn the lesson since &#x27;80
评论 #26388873 未加载
评论 #26390393 未加载
评论 #26388996 未加载
评论 #26389464 未加载
评论 #26389578 未加载
dhosekabout 4 years ago
I track my progress on the novel I&#x27;m writing by word count. I&#x27;ve had more than a few days of negative word count writing days which have invariably been some of my more productive days.
csoursabout 4 years ago
Disclaimer: I work for GM - this is solely my own opinion.<p>Whenever I hear people in the automotive industry boast about the complexity and lines of code in vehicles I weep and shake my head.
评论 #26390737 未加载
评论 #26393927 未加载
sanjabout 4 years ago
I once removed 4 lines of code.<p>The change, annualized, was somewhere around $12M in profit.<p>I&#x27;m still pretty proud of making -$3M&#x2F;LOC!
blunteabout 4 years ago
One of my tasks as a young developer was to make a shell script faster. The systems engineers (who used this script to setup and configure large scale network management systems) were complaining that the &quot;menu&quot; took 60 seconds or more between selections.<p>Ok, sure, sounds easy. Then I opened the script... 9000 lines. After reading and understanding what it was supposed to do, I rewrote it in 1500 lines (still basic SunOS unix shell code), and with reasonable use of internal data structures for caching so only the first menu visit required a time hit. Beyond that, it was 1 second for menu selections. To say the system engineers were pleased would be an understatement.<p>My manager was pleased but also displeased, because he was the author of the 9000 line monstrosity.
protomythabout 4 years ago
Say what you want about Steve Balmer but he had the right attitude towards that <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=kHI7RTKhlz0" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=kHI7RTKhlz0</a>
bjoliabout 4 years ago
I have had code I wrote replaced by something that was 30% smaller, faster and more stable. It was a good and humbling experience.<p>I contributed an inliner to a language about ten years ago. Inlining is a problem that might seem easy at first, but for me it was like trying to restrain a rabid dog on a leash. I was pretty damn pleased with the end results and it served the language implentation well until about 2015. Then someone with an actual understanding of the problem worked on it for a week and produced something that I would describe as poetry.
carapaceabout 4 years ago
&gt; My point today is that, if we wish to count lines of code, we should not regard them as &quot;lines produced&quot; but as &quot;lines spent&quot;: the current conventional wisdom is so foolish as to book that count on the wrong side of the ledger.<p>~Dijkstra (1988) &quot;On the cruelty of really teaching computing science (EWD1036).<p><a href="https:&#x2F;&#x2F;en.wikiquote.org&#x2F;wiki&#x2F;Edsger_W._Dijkstra" rel="nofollow">https:&#x2F;&#x2F;en.wikiquote.org&#x2F;wiki&#x2F;Edsger_W._Dijkstra</a>
jansanabout 4 years ago
Aaah, now I understand how people came up with the strange idea to place opening curly brackets into a new line. Suddenly this all makes sense.
ChrisMarshallNYabout 4 years ago
The best code is the code I don&#x27;t write.<p>As a manager, I would value a developer that spent a week, refining a small, high-quality, robust and performant class, than one that churned out rococo monsters in a short period of time.<p>I tend to write a lot of code, and one of the things that I do, when I refactor, is look for chunks I can consolidate or remove.<p>OO is a good way to do that. It&#x27;s a shame it&#x27;s so &quot;out of fashion,&quot; these days. The ability to reduce ten classes into ten little declarations of five lines each, because I was able to factor out the 300 lines of common functionality, is a nice feeling.<p>An interesting metric for me, is when I run cloc on my codebase. I tend to have about a 50&#x2F;50 LoC (Lines of Code) vs. LoC (Lines of Comments).
sdevonoesabout 4 years ago
Nowadays that should be phrased as: fewer features is better. But management doesn&#x27;t understand. They always want more features to be delivered (and faster than our competitors!), and so we end up with more code to maintain and in the need of hiring more developers (that&#x27;s actually another excuse as well to migrate our stuff to microservices!).<p>Companies only want to grow, they don&#x27;t care anymore about polished products.<p>Of course, I&#x27;m generalizing, there are some few companies that care about the product, but they are just a few.
JoeAltmaierabout 4 years ago
Consider the cost of lines of code in a solution. Double the lines means double the time spent to simply type them in. Double the time later to read them. Probably many more times than double to re-understand them. Double the time to explain them. Double the compile time. Execution time is probably around double.<p>It&#x27;s not just twice as good to write shorter code. Its something like 64X as good. By some ways of thinking.
评论 #26389503 未加载
hinkleyabout 4 years ago
Sometimes I wish I kept a better count of my deletions, because the &#x27;best&#x27; I ever recorded was just under 600 lines and I honestly feel a little regret that other people are managing much bigger deletions.<p>I think the real reason is that as I moved to refactoring (as part of that 600 LOC experience), my deletions per year went up but my deletions per story regressed toward the mean.
评论 #26388894 未加载
TimedToastsabout 4 years ago
Around the turn of the Willennium, I beat a long-standing &quot;Most C LOC approved in a month&quot; record at Old School Big Name Inc. and you are <i>not</i> taking it away from me.<p>No one had come close to that record in a decade and I beat it and you can kiss my keyboard if you think I was lazy about it. Harumph, I say!
methylabout 4 years ago
If you want to read about flawed metrics, how they affect the production and what to do about it in a form of interesting novel - check out The Goal by Elijjahu M. Goldratt. It&#x27;s a classic, but gets recommended seldom for how good it is.
einpoklumabout 4 years ago
More than the story itself, the website:<p><a href="https:&#x2F;&#x2F;www.folklore.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.folklore.org&#x2F;</a><p>is packed with stories which will make you smile, cry, or more enlightened. Or all of the above at the same time.
tregoningabout 4 years ago
Related :) <a href="https:&#x2F;&#x2F;twitter.com&#x2F;tregoning&#x2F;status&#x2F;1286329086176976896" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;tregoning&#x2F;status&#x2F;1286329086176976896</a>
Waterluvianabout 4 years ago
Folklore.org is full of fascinating anecdotes.<p>I&#x27;m starving for more stories of this size from CS history. PARC, Bell Labs, wherever! I&#x27;m sure there&#x27;s thousands of fun little stories out there.
评论 #26400175 未加载
Scarblacabout 4 years ago
Those few days that I managed -1000 lines of real code are among the happiest work-related days I had. It feels so good to find a simple solution that enables you to remove so much.
bdgabout 4 years ago
Is it just me or does the average engineer in most companies produce something like 150 lines of code per day when averaged over a year?
TheDudeManabout 4 years ago
&gt; they stopped asking Bill to fill out the form, and he gladly complied.<p>Compiled with what? Can one comply with an absence of request?
lambda_obrienabout 4 years ago
Is there anywhere which optimizes for LOC count today? I figure everyone knows by now LOC is a bad metric.
ne38about 4 years ago
we must measure edited lines not the difference between numbers of lines after and numbers of lines before! It is like if you work in money exchanges: there is buying and selling.
crsrabout 4 years ago
Bill Atkinson reminds me of Gilfoyle from Silicon Valley
chrisweeklyabout 4 years ago
In general, code is a liability, not an asset.
Havocabout 4 years ago
You can tell it’s folklore by the part where they stop making him fill out the form<p>3&#x2F;10 for realism
h0mieabout 4 years ago
jkj