Remix.run Logo
danmaz74 3 days ago

> "TTD forced you to sit down and design your system first, rather than making it all up on the fly"

It's interesting because I remember having discussions with a colleague who was a fervent proponent of TDD where he said that with that approach you "just let the tests drive you" and "don't need to sit down and design your system first" (which I found a terrible idea).

ffsm8 2 days ago | parent | next [-]

Yeah, your colleagues opinion is kinda inline with how it was usually pitched - at least around 2010 when I learned about it to a degree that it wasn't just a fuzzy concept to me.

One of the goals I remember was to think from the outside to the inside: you first create a test which asserts your most outter API as a unit test with inputs as you want to use it.

Now you keep adding functionality until it passes, creating new tests whenever you make a new boundary/function/API

This supposedly makes it easier to design it well, because you don't have to keep everything in scope and instead only tackle one layer at a time - like an onion from the outside to the core. And you always design the APIs as they make sense, not as is technically easiest because you can just define it however you want, and then think about implementing it.

E.g. https://www.infoq.com/presentations/tdd-ten-years-later/

stpedgwdgfhgdd a day ago | parent | prev [-]

Mmmm… read the book on Extreme Programming.

The idea is that you let the code drive the system and do not optimize prematurely. Sometimes developers design parts that are not needed, and often not in the first phase.

It is a way to evolve a system unbiased. Of course there is a trade-off. If the refactoring/change is very expensive, like a database schema change in production, it is good to spent a lot of upfront design. Takes experience to see where you can relax and where you need to be careful.