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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Minimalism - Omit Needless Code

13 点作者 visitor4rmindia将近 16 年前

5 条评论

makecheck将近 16 年前
It's not just short words that count; simple words count too.<p>A 5-word sentence with words that nobody knows, communicates nothing (or at least wastes time, as the dictionary is consulted).<p>The programming equivalent of this is to have a very good reason (and compactness isn't one) for using an advanced language feature. If nobody knows what the hell it does, and it isn't doing anything all that complicated, then you've wasted everyone's time.<p>This is an interesting statement:<p>"Code is not written to be read by Everyman: it needs an audience, and will be better off for having one in mind."<p>Well, yes it is written for the everyman. Organizations will have more average programmers than good ones, and if you care at all about maintainability, you will choose the path that is clearest (even if you are an expert).<p>Even if you can prove that a fancy solution is worthwhile -- and sometimes it may be, for speed/etc. -- you're still generally making debugging more difficult by hiding everything away, so it's a trade-off at best.<p>Take the article's for-loop example. The for_each() function is very hard to debug, because the only logical breakpoint is inside the code that iterates. And as a reusable object, that code could be run in <i>1000 other places</i> besides the point of interest; if you needed to insert a logging instance for just one case, you couldn't do it without affecting the 1000 other cases. With a regular for-loop, there's an easy place to insert code for debugging <i>just</i> that loop.
garnet7将近 16 年前
Rule 17: Omit needless words! Omit needless words! Omit needless words!
评论 #700732 未加载
edw519将近 16 年前
How ironic, a 4136 word essay about minimalism.
评论 #700982 未加载
pshc将近 16 年前
As always with this sort of writing the piece itself doesn't follow the rule it sets: there are many needless paragraphs spent ranting about laptop battery monitors.
pbhj将近 16 年前
Clarity - Eschew Extraneous Obfuscation