3 ms·
This is why designing the interface in a language with a powerful type system provides the same quoted benefit of TDD. It helps you think about the interface be
by embwbam 10y ago
This is why designing the interface in a language with a powerful type system provides the same quoted benefit of TDD. It helps you think about the interface before you move to implementation.
In my experience, using a type system to do this requires much less effort and refactoring.
- paulddraper 10y agoI am a big fan of "testing via types". Unit tests can demonstrate that my code is correct; it can say nothing about how my code is used by others. In contrast, a type system can extend those protections downstream. (Yes, yes, unless you go way off the deep end of dependent types, you still need tests. But a powerful type system can systemically prevent a huge number of very common bugs.)
- mercurial 10y agoMy take it on it is that it can remove most of the boring bugs you would get in a less strongly-typed language and leaves you open to the interesting bugs (eg, logic bugs). As for dependent types, I'm not sure that even then you would be able to ensure that, say, your cache is correctly invalidated.
- zamalek 10y agoAdditionally, strict TDD teaches you lessons. Once you've used it enough, chances are that you'll be making better interfaces even if you code first.
- user5994461 10y ago> This is why designing the interface in a language with a powerful type system provides the same quoted benefit of TDD. Yes. TDD came from developers who worked in weak/dynamic typed languages. It is mandatory to discover errors, that are otherwise discovered instantly for free by compilers in the stronger typed languages. Strangely, the TDD folks never outline this point.