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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Writing code that works on first go

23 点作者 chegra84将近 14 年前

6 条评论

qntm将近 14 年前
I instinctively distrust code that works first time. I advocate error-driven development.
评论 #2747624 未加载
评论 #2747693 未加载
评论 #2748070 未加载
dustingetz将近 14 年前
1. an ide/language with really good static analysis 2. aggressively minimize codebase complexity<p>done. when my code doesn't work the first time, and i'm writing in a static-typed language, it's usually due to high accidental complexity in my code or code i interface, requiring me to keep too much context in my head, causing logical problems and problem states to be non-obvious.<p>stupid errors like writing an if statement wrong, is sophomoric. "most common errors" really means avoiding mutable state &#38; leaky abstractions[1]. i do think the OP gets this, it just doesn't come across too clearly.<p>[1] nostrademons of HN, "how to become an expert swegr" <a href="http://news.ycombinator.com/item?id=185153" rel="nofollow">http://news.ycombinator.com/item?id=185153</a>
评论 #2748097 未加载
gtani将近 14 年前
Should generate some debates, depending on if you're from the static/dynamic typing, IDE vs. wetware, TDD or not, etc camps.<p>3. If you use IDE's or vim/textmate/emacs and a decent language plugin, you'll argue the IDE should match braces and insert skeletal control structures.<p>5. Self-contained function, so no side effects, isn't that part of the definition of functional purity in them "academic languages" (heh)?<p>6. How do you define edge and corner cases? Is there something like QuickCheck for your dev environment?
jaxn将近 14 年前
I think it would be great if there was a way to easily capture my "most common error categories".<p>Years ago I got bit a couple of times by assignment instead of comparison errors (i.e. if(x = 1) instead of if(x == 1))<p>I noticed a pattern and made a conscious to always put the variable last in comparisons, so for years I have written if(1==x) so that the compile would fail if I wrote if(1=x).<p>Having a way to see my most common errors would give the opportunity to look for similar error-proofing measures.
评论 #2747836 未加载
评论 #2747936 未加载
评论 #2748102 未加载
kstenerud将近 14 年前
I'm far more interested in code that works when it ships than code that works the first time it's run.<p>Code that works the first time it's run is magical, and therein lies the problem: Magic code is untested and unproven code. It offers a false sense of security, which is why it fills experienced developers with a sense of dread.<p>Until you prove that code's correctness (such as with tests), it is almost certain that it has nasty bugs in it that your initial successful run haven't uncovered. So what does having it work the first time give you? Bragging rights, maybe, but nothing of any real value to shipping code.
评论 #2747947 未加载
评论 #2748060 未加载
评论 #2748021 未加载
chopsueyar将近 14 年前
Non-IDE Python programmer comments, please?
评论 #2748485 未加载