This is important.
I'll 🧵a few thoughts of mine... on why I consider TDD valuable.
Disclaimer: I think TDD is important enough to written more than one unit test framework and my assert library just celebrated it's first decade.

That said I don't TDD even nearly all the time. https://twitter.com/davefarley77/status/1288130201508093952
TDD isn't hard but it firmly nudges you towards a continuous practice of problem decomposition.

It's the best way to learn and practice that I've found and it changes how you write code even when you don't go test first.

I spike better because I practice TDD.
TDD forces you to think sin smaller slices and constantly checkpoints your problem definition.

This is insanely annoying, or gratifying, in the same way that Haskell's strong type system is annoying, you need to know what you want before you get a thing.
TDD works because it makes you write more code.
More code is more practice time.
Coding is part a craft part of your growth especially for the first few decades simply comes from doing more of it (in a reasonably mindful way).

It's a work integrated practice.
TDD works because you explore a broader design space, that of your "actual problem" and that of the checking your thoughts and its implementation.

You not only write more code, you solve a more varied set of problems.
TDD works because you're constantly using the things you're building.

Thus your API and objects grow from the needs of additional clients, strengthening them but this also forces you to earlier consider the experience and usability of your code outside that one idea you had.
TDD works because it hurts.
When you do any of the above badly you end up with a mess.
Cleaning messes is where you really learn how your designs, habits and understanding failed you.

It's no fun, but it's valuable.
TDD works because it forces you to slow down.
That reveals gaps in your fluency, of expression, thought, design, understanding.

It's a deliberate practice.

And one that I find satisfying and exhausting.
TDD doesn't work because it gives you documentation or verification.

Unless you integrate ways of doing things that lie outside the commonly seen Red-Green-Cleanup cycle.

It does better than nothing for both. But it doesn't magically produce either.
You can follow @drunkcod.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled:

By continuing to use the site, you are consenting to the use of cookies as explained in our Cookie Policy to improve your experience.