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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

The Design of Software is a Thing Apart

198 点作者 nancyhua超过 7 年前

13 条评论

Chaebixi超过 7 年前
&gt; Those who speak of “self-documenting code” are missing something big: the purpose of documentation is not just to describe how the system works today, but also how it will work in the future and across many versions. And so it’s equally important what’s not documented.<p>Documentation also (can) tell you <i>why</i> the code is a certain way. The code itself can only answer &quot;what&quot; and &quot;how&quot; questions.<p>The simplest case to show this is a function with two possible implementations, one simple but buggy in a subtle way and one more complicated but correct. If you don&#x27;t explain in documentation (e.g. comments) why you went the more complicated route, someone might come along and &quot;simplify&quot; things to incorrectness, and the <i>best</i> case is they&#x27;ll rediscover what you already knew in the first place, and fix their own mistake, wasting time in the process.<p>Some might claim unit tests will solve this, but I don&#x27;t think that&#x27;s true. All they can tell you is that something is wrong, they can&#x27;t impart a solid understanding of <i>why</i> it is wrong. They&#x27;re just a fail-safe.
评论 #16164719 未加载
评论 #16164544 未加载
评论 #16163433 未加载
评论 #16163257 未加载
panic超过 7 年前
Peter Naur&#x27;s &quot;Programming as Theory Building&quot; also addresses this topic of a &quot;theory&quot; which is built in tandem with a piece of software, in the minds of the programmers building it, without actually being a part of the software itself. Definitely worth a read: <a href="http:&#x2F;&#x2F;pages.cs.wisc.edu&#x2F;~remzi&#x2F;Naur.pdf" rel="nofollow">http:&#x2F;&#x2F;pages.cs.wisc.edu&#x2F;~remzi&#x2F;Naur.pdf</a>
评论 #16164434 未加载
评论 #16162336 未加载
评论 #16163176 未加载
评论 #16162648 未加载
评论 #16166868 未加载
评论 #16165254 未加载
jrochkind1超过 7 年前
I would love to see the pendulum swing back around to _good design_ again.<p>It matters more when designing libraries&#x2F;frameworks than one-off apps.<p>Switching to a new framework&#x2F;platform&#x2F;language at the point the one you were on before finally matured enough that it was hard to ignore the need for good design doesn&#x27;t actually help. you&#x27;ll still be back eventually.
评论 #16162928 未加载
fooblitzky超过 7 年前
The OP doesn&#x27;t seem to understand TDD:<p>&quot;So you update the code, a test fails, and you think “&#x27;Oh. One of the details changed.&#x27;&quot;<p>Some of the concerns they raise about writing tests are covered by Uncle Bob here: <a href="http:&#x2F;&#x2F;blog.cleancoder.com&#x2F;uncle-bob&#x2F;2017&#x2F;10&#x2F;03&#x2F;TestContravariance.html" rel="nofollow">http:&#x2F;&#x2F;blog.cleancoder.com&#x2F;uncle-bob&#x2F;2017&#x2F;10&#x2F;03&#x2F;TestContrava...</a> and here: <a href="http:&#x2F;&#x2F;blog.cleancoder.com&#x2F;uncle-bob&#x2F;2016&#x2F;03&#x2F;19&#x2F;GivingUpOnTDD.html" rel="nofollow">http:&#x2F;&#x2F;blog.cleancoder.com&#x2F;uncle-bob&#x2F;2016&#x2F;03&#x2F;19&#x2F;GivingUpOnTD...</a>
评论 #16166798 未加载
eikenberry超过 7 年前
Seems to me there might be ways to program that convey more information. For example flow-based programming (FBP) seems like it might help and should help make the flow of the program explicit and obvious. That is, inherent to the code is a high level overview of what it does.<p>From my own limited experience it can make explaining a program to someone new almost trivial. You just use the various flows defined as almost visual guides to what is happening. I don&#x27;t want to say FBP is a silver bullet, but I think it points to the idea that it is possible capture much more of the theory and design of the program in the code.
eksemplar超过 7 年前
We’ve increased our productivity by quite a lot over a five year period by ditching most testing on smaller applications.<p>Basically our philosophy is this: a small system like a booking system which gets designed with service-design, and developed by one guy won’t really need to be altered much before it’s end of life.<p>We document how it interfaces with our other systems, and the as-is + to-be parts of the business that it changes, but beyond that we basically build it to become obsolete.<p>The reason behind this was actually IoT. We’ve installed sensors in things like trash cans to tell us when they are full. Roads to tell us when they are freezing. Pressure wells to tell us where we have a leak (saves us millions each year btw). And stuff like that.<p>When we were doing this, our approach was “how do we maintain these things?”. But the truth is, a municipal trash can has a shorter lifespan than the IoT censor, so we simply don’t maintain them.<p>This got us thinking about our small scale software, which is typically web-apps, because we can’t rightly install&#x2F;manage 350 different programs on 7000 user PCs. Anyway, when we look at the lifespan of these, they don’t last more than a few years before their tech and often their entire purpose is obsolete. They very often only serve a single or maybe two or three purposes, so if they fail it’s blatantly obvious what went wrong.<p>So we’ve stopped worrying about things like automatic testing. It certainly makes sense on systems where “big” and “longevity” are things but it’s also time consuming.
mpweiher超过 7 年前
<i>the information of a program’s design is largely not present in its code</i><p>And that&#x27;s the problem. We need ways to make those higher level designs (~architecture) code.
评论 #16162083 未加载
评论 #16162948 未加载
评论 #16163014 未加载
评论 #16163025 未加载
评论 #16162025 未加载
评论 #16165041 未加载
评论 #16163689 未加载
Chiba-City超过 7 年前
This is a lovely article. Software is a possibly a) errant and b) misinterpreted operational semantics of some other semantic horizons of contractual or implicit expectations. Knuth&#x27;s Literate Programming was onto something. We inhabit a world of word problems and even faulty realizations of rarer formal specifications. Claims concerning &quot;phenomena in the world&quot; drive maintenance and enhancement regimens.
评论 #16164750 未加载
charlysl超过 7 年前
1 point by charlysl 21 minutes ago | edit | delete [-]<p>Wouldn&#x27;t it be better to use data abstraction instead of abusing primitive types?<p>For instance dates are often abstracted as a Date type instead of directly manipulating a bare int or long, which can be used internally to encode a date.<p>So, age, which isn&#x27;t an int conceptually (should age^3 be a legal operation on an age?), could be modelled with an Age type. This, on top of preventing nonsense operations, also allows automatic invariant checking (age &gt; 0), and to encapsulate representation (for instance changing it from an int representing the current age to a date of birth).
robotresearcher超过 7 年前
return x &gt;= ‘A’;<p>Would be better than<p>return x &gt;= ASCII_A;<p>surely. ASCII_A could be set incorrectly, or have a dumb type, and is more verbose anyway. By using the character directly, the code speaks its purpose.
评论 #16162574 未加载
评论 #16162492 未加载
评论 #16164412 未加载
评论 #16165782 未加载
评论 #16162329 未加载
评论 #16164751 未加载
评论 #16165758 未加载
moolcool超过 7 年前
I wish websites wouldn&#x27;t change the browsers default scrolling behavior
评论 #16163148 未加载
bringtheaction超过 7 年前
I misread the title as &quot;the design of software is a thing of the past&quot;. I welcome the actual title and content though.
erpellan超过 7 年前
I lost interest after &#x27;that is a fatal mistake&#x27;.<p>Fatal mistake? Really? An unrecoverable failure?<p>So, none of the software I&#x27;ve written in the last decade worked, despite all evidence to the contrary?<p>Right.