5 ms·
> However, using them to the extent of "returns an Object of this type" is absurdly verbose and pollutes the code base with roundabout information. I did not t
by mseepgood 12y ago
> However, using them to the extent of "returns an Object of this type" is absurdly verbose and pollutes the code base with roundabout information.
I did not talk about unit tests. I do not test stupid things like "returns object of this type". I test functionality (more like integration tests). If the functionality works then things like "returns object of correct type" or "items in collection are treated correctly" are tested implicitly or don't matter.
People with ridiculously complex type system programming languages have to write these automated tests as well, because even ridiculously complex type systems like Idris don't ensure the correctness of non-trivial logic.
- andreasvc 12y agoYour argument that typing is tested implicitly or doesn't matter is false, because your function might have 73 code paths, of which your test only covers 1. Tests and types are complementary. A test will prove that in at least one case the function does what it should, but a type system can prove that in all cases at least the types are correct. There was a blog post describing this as establishing a upper vs. a lower bound.
- mseepgood 12y agoYou have to write tests for the other 72 code paths anyway, because types can't ensure the behavioral correctness of these 72 code paths. Correct types don't help when the behavior can be broken. And when you have to write these tests anyway then you don't need the types anymore.