Hacker News new | past | comments | ask | show | jobs | submit login

> test and integration tests are (bad) substitutes for good and modular design, which should piggyback on a strong type system

This sounds completely hand wavy. If the design is in fact modular and built of autonomous components then it should be relatively easy to test and should be tested. Types are no substitute for testing and are completely orthogonal to testing.

> Test code is brittle code

If this is the case then the code being tested is more than likely brittle as well. Test code reflects the system under test more than anything else.

> You need tests because you're using a dynamically typed language

No you simply need tests in any language.




> Types are no substitute for testing.

I don't agree with the person you're replying to that types make tests redundant, but to claim that types can't substitute a large amount of testing can only come from inexperience.

Whatever property you can model successfully through a closed type, is a property you never have to test ever again anywhere it's being used. If you have 500 functions that take a NonEmptyString, those are 499 fewer property checks in tests (because you should have one test for the type constructor).


> types can't substitute a large amount of testing can only come from inexperience

That is a very bold assertion I have seen no evidence for. I write very few tests in Ruby or Javascript aimed at validating types.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: