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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

The Applied Theory of writing bug-free code

22 点作者 clawrencewenham超过 15 年前

6 条评论

swombat超过 15 年前
I stopped reading at "strong typing". (well, not really... but I started typing this comment roundabout there)<p>First of all, what he describes is not called strong typing, it's called static typing. Ruby, for example, has strong typing (every object is one type and one type only), but not static typing (you don't declare the type of an object when you declare a variable).<p>Secondly, there are many powerful languages that don't have static typing. Is the author implying that those languages are inherently buggy?<p>Thirdly, the author is not advocating what he declares in the title. He proposes methods to catch bugs, not to avoid them. His methods are also flawed in that redundancy does not ensure bug-free code - only that you haven't made any silly mistakes in your coding. Bugs come from all sorts of sources, and "code typos" are only one minor source. Other sources include: maintenance changes (which cause unforeseen effects that were not previously covered by tests), design flaws, and changed external circumstances. None of those are covered by the technique he lists.<p>Sorry, but this is just a poor attempt to capitalise on a catchy title. Nothing to see.
评论 #874037 未加载
评论 #874110 未加载
评论 #873960 未加载
anatoly超过 15 年前
I'm forever intrigued by the mind's ability to discern patterns. Today I realized that just from the few examples that appeared on HN, my mind has - quite unconsciously - locked on the combination of google.com in the site slot and a title about programming and its methodology. "Oh, it's that yacoset person", my mind tells itself without words, and I feel a little jolt of recognition-cum-disappointment (for the pieces are usually fluffy and fussy). I distrust myself, and so I hover over the link to make sure, yet so far the pattern has held without fail.
评论 #873919 未加载
russell超过 15 年前
What he is really arguing for is more redundancy in programming. Strong typing (he really means static typing), so you can type (with your fingers) thing more than once and you can put constraint enforcing wrappers around your values. Assertions an method contracts, TDD and unit tests, and finally NASA style parallel development.<p>Except for unit testing, I question most of it. The problem with too much redundancy is that it slows you down. If you create too much ceremony, it takes 20 mediocre programmers to do poorly what 5 good programmers can do well.<p>I would much prefer good tools to redundancy, for example type inference over Java style type repetition. Maybe you can use asserts as a programming aid, but not in production. If you may get null values, deal with them; try not to create an exception for someone else to deal with. And if we used NASA style coding, it would take 5 years to get a web site up.
评论 #873733 未加载
评论 #873553 未加载
评论 #873577 未加载
diN0bot超过 15 年前
i don't know. in college i wrote static and dynamic program analyzers, and was in a very pro-java-typing group. when i moved to python i was sure the lack of typing would be problematic.<p>the lack of static typing has NEVER caused a bug. a few times i will have a bug because i mispell a variable name, thereby inadvertantly creating a new variable, but i have always found those problems on the next run of the program.<p>vastly more useful are creating tests and using them often.<p>to be fair to my college days, i still create object models (ish...i have my own version) and other diagrams, which i find crucial for design and frequent reference aftewards.<p>the whole "type" thing must be important for other problem domains.
评论 #873688 未加载
评论 #873740 未加载
评论 #873953 未加载
评论 #873649 未加载
danbmil99超过 15 年前
the implicit assumption in all of these arguments is that it's more important to ship bug-free (or as close as you can get to bug-free) code than to ship quickly. In the real world, that is almost never the case. In fact, I can't think of a single situation in which it is ever the case.
评论 #874278 未加载
评论 #874155 未加载
rgiar超过 15 年前
the redundancy idea scales as much as you want it to; this post remixed: <a href="http://socialfact.com/reader/seemore-how-much-are-you-willing-to-pay-for-software-perfection-1" rel="nofollow">http://socialfact.com/reader/seemore-how-much-are-you-willin...</a>