Professional Documents
Culture Documents
Computer Things
https://twitter.com/GeePawHill/status/1556825728326553600
That thread (it's a good one) argues that the problem was an
organization failure by TDD proponents, pushing too hard and
letting memetic decay transmute "TDD" into "tests r gud". I
have a different explanation: TDD isn't as valuable as its
strongest proponents believe. Most of them are basing TDD's
value on their experience, so I'll base it on mine.
https://buttondown.email/hillelwayne/archive/i-have-complicated-feelings-about-tdd-8403/ 3/14
12/25/23, 4:55 PM I have complicated feelings about TDD • Buttondown
Read 12 replies
Analyzing Maximalism
The maximalist case for TDD comes from two benefits: it's
good for your testing and it's good for design.
Verification
https://buttondown.email/hillelwayne/archive/i-have-complicated-feelings-about-tdd-8403/ 4/14
12/25/23, 4:55 PM I have complicated feelings about TDD • Buttondown
Read 11 replies
Integration testing
End-to-end testing
Mutation testing
Fuzzing
Property testing
Model-based testing
Manual testing
Code review
Type systems
https://buttondown.email/hillelwayne/archive/i-have-complicated-feelings-about-tdd-8403/ 5/14
12/25/23, 4:55 PM I have complicated feelings about TDD • Buttondown
Static analysis
Contracts
Shoving assert statements everywhere
"But nobody says unit tests are all you need!" Well consider
yourself lucky, because I've run into that strain of maximalism
many, many times. If you use TDD you don't have bugs, so if
you have bugs you didn't use TDD right.
I don’t have to write the test for nil because I know that
nil will never be passed. I don’t need to make states
unrepresentable, if I know those states will never be
represented. — Tests and Types
But that's impossible. Unit tests only cover units. There are no
side effects, nondeterminism, or sequences of events. They
only cover what the programmer thought to test, and only the
specific inputs they chose. But many serious bugs are higher
level, from correct components interacting in a bad way (1 2
3).4 Or they only happen with very specific inputs. Or they
always happen on a nil, but there's only a specific call chain
that could pass nil. You never know if states will never be
represented.
"Design"
https://buttondown.email/hillelwayne/archive/i-have-complicated-feelings-about-tdd-8403/ 6/14
12/25/23, 4:55 PM I have complicated feelings about TDD • Buttondown
Daniel Moka
@dmokafa · Follow
Tests are not the outputs of TDD. Tests are the inputs and
the clean design and code are the outputs.
12:00 PM · Nov 30, 2020
Read 14 replies
Read 8 replies
Are these necessarily bad? No. Can they bad? Yes! Sometimes
large functions make for better abstractions and small
functions lead to confusing behavior graphs. Sometimes
dependency injection makes code a lot more complex and
hard to understand. Sometimes large public APIs tightens
module coupling by encouraging reuse of "implementation
https://buttondown.email/hillelwayne/archive/i-have-complicated-feelings-about-tdd-8403/ 8/14
12/25/23, 4:55 PM I have complicated feelings about TDD • Buttondown
def quicksort(l):
if not l:
return []
out = [l[0]]
for i in l[1:]:
if i <= out[0]:
out = [i] + out
else:
out.append(i)
return out
https://buttondown.email/hillelwayne/archive/i-have-complicated-feelings-about-tdd-8403/ 9/14
12/25/23, 4:55 PM I have complicated feelings about TDD • Buttondown
@given(st.lists(st.integers()))
def test_it_sorts(l):
out = quicksort(l)
for i in range(1, len(l)):
assert out[i] >= out[i-1]
Read 3 replies
In defense of TDD
My point is that it can also make your design worse. Some TDD
is better than no TDD, but no TDD is better than excessive
TDD. TDD is a method you use in conjunction with other
methods. Sometimes you'll listen to the methods and they'll
give conflicting advice. Sometimes, TDD's advice will be right
https://buttondown.email/hillelwayne/archive/i-have-complicated-feelings-about-tdd-8403/ 11/14
12/25/23, 4:55 PM I have complicated feelings about TDD • Buttondown
Read 48 replies
Conclusions
https://buttondown.email/hillelwayne/archive/i-have-complicated-feelings-about-tdd-8403/ 12/14
12/25/23, 4:55 PM I have complicated feelings about TDD • Buttondown
I have no idea where I'm even ending up. This "one day
newsletter" took three days and 2500 words and I don't know
if it made anything clearer for me or for any of you. I don't
even know if my understandings are valid, because I didn't do
much research or work through any of the nuances. This is why
I should leave this stuff to the blog and just use the
newsletter for regex stanning.
3. No, it's not who you're thinking of. It's a guy who isn't really
known outside of some Chicago tech circles. ↩
4. Lots of serious bugs are also at the unit level: see simple
testing can prevent most critical failures. ↩
https://buttondown.email/hillelwayne/archive/i-have-complicated-feelings-about-tdd-8403/ 13/14
12/25/23, 4:55 PM I have complicated feelings about TDD • Buttondown
You just read issue #191 of Computer Things. You can also
browse the full archives of this newsletter.
Subscribe
Brought to you by Buttondown, the easiest way to start and grow your newsletter.
https://buttondown.email/hillelwayne/archive/i-have-complicated-feelings-about-tdd-8403/ 14/14