, 12 tweets, 3 min read
My Authors
Read all threads
Well, I was going to write about "Doing it wrong" today, but it turns out that I already have. This article isn't quite what I'd say today but it's close:

ronjeffries.com/articles/019-0…

1/12
What would I say today that's different? Well, I'd clarify that there are at least three main ways that a TDD that doesn't work could differ from one that does:

- different design style.
- different problem: "TDD doesn't work here"
- different thing: "not TDD"

2/12
TDD favors a design style that leads to lots of very small, encapsulated items: classes, methods, functions.

If your preferred design style doesn't lean that way, you'll likely find TDD to be of less value.

3/12
TDD works best on problems where much of your code produces results that are easily tested. It's easy to test square root by trying a few numbers and checking them. It's tricky to test a path-finding algorithm, because you, the human, may not know the answer.

4/12
Similarly, most of us find GUI testing to be difficult with TDD. And so on.

So if your problem space doesn't come down to readily testable steps, steps where you can call your shot before you make it, TDD will likely be of less value to you.

5/12
And, let's face it, there's more to TDD than "write a small test, run it red, make it green, refactor". The selection of the test, so that making it green is just a few lines of code, is simple, but not easy.

6/12
And reflecting back to design style, if your style of refactoring isn't consistent with that of those who prefer TDD, you may encounter problems. If every time you refactor, all your tests break, you're definitely not doing what we do. Because ours don't break!

7/12
Now there is still a common pattern to all these, which in fairness I guess I'd call "You're not doing what we do". What you're doing isn't wrong ... but it's not what we do, /if/ you're working different problems in a different style, using different selection criteria.

8/12
That's not really "wrong" in any sense of correctness, much less morality. But ... if you move your knights only on the diagonals, you may be playing a fascinating game and playing it well, but ...

"You're playing chess wrong."

9/12
TDD provides enough value to enough people that they keep doing it, and despite not making any money for doing so, they support the idea and try to help others to get the same value.

It would be silly to claim that that value does not occur.

10/12
And it would be interesting, and valuable, if someone were able to bring together a clearer understanding of when TDD is of value, how much value it brings ... and when it isn't of so much value, and why not.

11/12
But as the article says, saying TDD doesn't work is a lot like standing in the middle of London and saying there's no way to boil leaves to make a tasty drink.

12/12
Missing some Tweet in this thread? You can try to force a refresh.

Enjoying this thread?

Keep Current with Ron Jeffries

Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Follow Us on Twitter!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just three indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!