Hacker News new | ask | show | jobs
by simonw 1386 days ago
I've found that strict write-the-tests-first TDD doesn't work for me for most problems. The exception is things like "parse specific components out of this string" - really straight-forward this input should result in this output code, where sometimes I'll write the tests first.

What DOES work for me is having a rule that any implementation should be accompanied by tests that prove the implementation works, bundled in the same commit.

I've been doing this habitually for a few years now and it has had a dramatic positive impact on my productivity.

I wrote a bit about how I do this here: https://simonwillison.net/2020/Feb/11/cheating-at-unit-tests...