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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

TDD and the Zero-Defects Myth

6 点作者 sklivvz19715 个月前

1 comment

hitchstory5 个月前
&gt;If you’ve ever heard someone claim that Test-Driven Development leads to zero-defects code<p>I havent. It&#x27;s a <i>lot</i> more reliable, still not 100% reliable.<p>&gt;If you can define the inputs, predict the outputs, and cover edge cases, TDD is like a superpower. But the real world is rarely that tidy.<p><i>shrug</i> it ought to be that tidy if you specify your features before building them.<p>For writing code to test a sin function (a bit of a contrived example, but let&#x27;s run with it) - well, that would be an excellent candidate for property test driven development because there are straightforward invariants you can define.<p>When edge cases crop up for other styles of code, well, talk about them with your PM and write test cases for them too.<p>If the spec is something like a UI which is visual and specified imprecisely with a sketch or something, snapshot test driven development more appropriate but that&#x27;s still just a variant of TDD.