TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

TDD is Not Hill Climbing (except where it is)

12 pointsby KentBeck11 months ago

1 comment

sureglymop11 months ago
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 未加载