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.

Common Fundamental Theorem of Software Development

18 pointsby highCsabout 9 years ago

9 comments

pmiller2about 9 years ago
This sounds like a load of pseudo-mathematical bullshit to me.<p>I agree with the principle behind it, which I believe to be &quot;all else being equal, fewer lines of code is better than more lines of code,&quot; but I&#x27;d argue that all else is rarely equal. Sometimes, spelling things out in a slightly more verbose way is better than using some slick one-liner.<p>When I was in grad school, I was that guy who would strive to get his proofs as short as possible, but no shorter. Since my audience consisted of fellow students (who could be expected to be at least as capable as me), and PhD mathematicians, a short, clever proof had much higher value than a long, plodding argument. (But, even the short proof needed to be understandable: I recall reading a paper co-authored by several famous mathematicians that included a diagram to show the structure of the proof, not the mathematical objects that were the subject of the proof!)<p>Software is not mathematics and it shouldn&#x27;t be treated as such. Remember that code is read many more times than it is written; and that the audience is the people who will come behind you and read the code, not the compiler.
评论 #11271676 未加载
maxanderabout 9 years ago
I think your conclusion might be vacuous, or at least oversimplified. What is &quot;value&quot;? If we don&#x27;t assume that it takes a programmer a set amount of time to write any line of code (and I know it takes me much longer to do linear algebra in Haskell than bung out a bunch of arithmetic in Python), any manager would be just as happy with B. B might even be more maintainable- it might be so long because its done in Knuthian-style literate programming, say- or have other virtues above A, increasing its &quot;value,&quot; by most peoples&#x27; estimation.<p>What in particular do you mean when you say A is &quot;greater&quot;?
评论 #11270955 未加载
hNewsLover99about 9 years ago
I&#x27;m no expert but it seems to me that the relative value of two programs (or functions or classes or whatevers) can be determined by only their LOC count only in the most trivial cases - e.g., a class that uses a single construtor&#x2F;parameter signature and performs a single task under a single set of conditions.<p>If the logic has to handle multiple, possibly overlapping parameters and branching conditions in order to &quot;do the same thing&quot;, then the longer code may well &quot;outperform&quot; the shorter one by whatever metric is most relevant to the use case (e.g., perform faster, use less energy, use less memory, be more readable, maintainable, portable, secure, or any weighted or unweighted combination of such metrics).<p>Does this make sense or am I missing something??
评论 #11271698 未加载
greenyodaabout 9 years ago
<i>&quot;Given any two unobfuscated source codes, the one that produces more value in average per line of code is greater.&quot;</i><p>For some software, higher performance is more valuable than fewer lines of code. For example, if you re-wrote the Linux kernel in Lisp, it might have many fewer lines of code than the current C version, but would deliver less value because it would run much slower and might stop for garbage collection in the middle of an interrupt handler. Concerns about real-time performance and memory-usage would also apply to lots of embedded software, like the code that controls the engine in your car.<p>I&#x27;m not sure that I&#x27;d call something a &quot;fundamental theorem of software development&quot; if there are large classes of software that it doesn&#x27;t apply to.
评论 #11270912 未加载
prmphabout 9 years ago
Not to nitpick, but you might want to check your grammar and spelling. It&#x27;s &quot;lemma&quot;, not &quot;lemme&quot;, for one thing, and &quot;produce&quot; should be &quot;produces&quot;
评论 #11270896 未加载
gdpelicanabout 9 years ago
There&#x27;s definitely some linear algebra which should be happening in the head of any programmer as s&#x2F;he writes code, some combination and balance of functionality, conciseness, performance, readability &#x2F; maintainability, extensibility, etc.<p>I&#x27;d suggest that this lemma doesn&#x27;t quite take into account that software quality isn&#x27;t just about what it is able to do today, but how efficiently it&#x27;s able to adapt or be repaired in the future.
Kinnardabout 9 years ago
I wonder what PG would think of his given his notion of &quot;power&quot; as exemplified by his language arc: <a href="http:&#x2F;&#x2F;www.paulgraham.com&#x2F;arcchallenge.html" rel="nofollow">http:&#x2F;&#x2F;www.paulgraham.com&#x2F;arcchallenge.html</a>
highCsabout 9 years ago
So yeah, got this thing in my head while taking a shower this morning. Any feedback is welcome.
pizzaabout 9 years ago
The idea is interesting! I think you might want to use a more generic metric.
评论 #11270921 未加载