2 ms·
> Defensive programming can be achieved through various means. Type checking is one of them and often can't replace Unit and Integration testing. Of course the
by Tehnix 8y ago
> Defensive programming can be achieved through various means. Type checking is one of them and often can't replace Unit and Integration testing.
Of course they won’t replace unit or integration tests, but they will replace a lot of damn trivial tests you have to write to make sure you exercise all paths of the program, because there are no types to help you.
Also, at least when I think of defensive programming, I don’t think of how Haskell et al. allow me to more clearly express my intents in the type system. I think of the times where I write JS/TS and cannot rely on any data anywhere being in the format it says it’s in.