DEV Community

Discussion on: Beyond Static Typing

Collapse
 
szymach profile image
Piotr Szymaszek

TDD makes sure you do not make basic errors in your code and catch faulty design quickly. It asserts calculations and conditions are done properly.

Static typing makes sure you put the pieces where they belong.

Both of these are complementary.

Collapse
 
jessekphillips profile image
Jesse Phillips

I don't think I tried to claim static typing promotes design, only that TDD does not produce good design and I recommend DRCT for better design.

Collapse
 
szymach profile image
Piotr Szymaszek

Well it is not TDD's responsibility to produce design at all, but to verify if your design is sensible and actually does what you want. It is a part of good design, as is static typing, so I am not quite sure why you would promote one over the other.

Or maybe I am just misunderstanding what you mean by DRCT? Could you please elaborate?

Thread Thread
 
jessekphillips profile image
Jesse Phillips

I agree that TDD has no responsibility for design. Yet you use phrases like "verify if your design is sensible" and "catch faulty design quickly" these to me sound like responsibility and the exact things I mean it doesn't do when I say produce.

Thread Thread
 
szymach profile image
Piotr Szymaszek

I understand the confusion, since we are talking about a thing that is not just one component.

Saying TDD produces good design is incorrect - it is just a technique you can use to quickly get feedback on the design decisions you have made. Can you make these decisions without it? Yes. Is it easier to do so with it? Personally I would say so. Is it enough to achieve that? Definitely not.

As much as I agree that static typing is great and we could use even more ways of validating code before you even compile it, I cannot agree it makes TDD obsolete. I just do not see how you would have to choose one over the other, to me they are complementary.