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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

TDD is Not Hill Climbing (except where it is)

12 点作者 KentBeck11 个月前

1 comment

sureglymop11 个月前
What I never understood about TDD is: why would one have to write the test first?<p>Now, I get that maybe the reason is human psyche and that one may not have the same discipline to write the test after the code. But, stripping that away, more logically asking, why does the test need to exist first?<p>I get that if you have a test, you have an exact &quot;plan&quot; of what your code needs to do&#x2F;return and you then work on it until the test passes.. But isn&#x27;t that the case already in any strongly typed language? You constrain the set of values your function can return to only the set of all valid values by defining a type (which is that set). (Okay I may have answered my own question, as we do define the expected type first).<p>I think that at the end of the day it comes down to finding a balance between complete formal validation of correctness and productivity&#x2F;usability i.e. actually getting something done. TDD strikes me as a practice that slows you down a fair amount yet still doesn&#x27;t offer anything close to complete formal validation, so it doesn&#x27;t seem that attractive to me. But I still also wonder what alternatives are out there.
评论 #40855642 未加载
评论 #40866970 未加载
评论 #40854759 未加载
评论 #40862013 未加载