@faassen @jasongorman unironically, all I heard from TDD people is like...
Translate specs to tests, before you change behaviour, change tests. But the problem is that when you don't have implementation yet, to do most kinds of tests, you need to create replace stuff "behind the interface" with something.
I think with most people (me included), there is where the problematic aspect comes into play. I'm not convinced that in we'll typed languages TDD benefits is distinguishable from just writing tight types.
But, of course, I wouldn't spew hot takes like the one quoted ๐
@jasongorman @faassen by doing what TDD tells me to do โ writing them before the implementation! ๐
@jasongorman @faassen oh, but meaningful tests, according to me, are invariant tests, e2e tests, performance tests, blah-blah-blah, stuff that wants implementation (often beyond the boundaries of the interface)!
In teams I manage, I suggest reframing unit tests as *the* tool to write most of regression tests, but not as a tool to increase the evidence of even correctness.
"You wouldn't test a theorem".
@jasongorman @faassen unironically cool take! Almost a kลan.
That's why you iterate. I have no idea what the implementation will look like, so I start with some test. Often a guiding test. It teaches me about the API I might want. As I expand the code and tests I rearrange it all frequently as I learn.
Type driven development is also cool but I think mostly complementary to tests.
@faassen @jasongorman yeah, I think the truth lies in nuanced understanding of why we do things that we do. This is a banger approach by a mature and diligent developer.
I lack diligence and I spend (probably more time than you) on refactoring interfaces rather than proactively mocking.
You know, this conversation makes me think that when I was young I didn't understand TDD because I didn't have enough experience and I thought that mocks are a replacement for e2e. Then I got disillusioned in the misconception, which resulted in behavioural apprehension lasting second decade now. ๐
@jonn @jasongorman I'm not a huge fan of mocks. I mock when it's an external well-defined thing (which I might create for the purposes of decoupling) otherwise I try to test at the highest layer where it's still easy to test.
I like getting the types right as well, and this too teaches me about how to structure things.
@jonn @faassen And how do you know you need those types?