5 ms·
I don't think you're wrong, but if you believe (like I do) that tests are a time saver, even in the short term, once you have good tests, typing doesn't save 38
by latch 8y ago
I don't think you're wrong, but if you believe (like I do) that tests are a time saver, even in the short term, once you have good tests, typing doesn't save 38% anymore..it saves, maybe 1%.
I'll add that, in my experience, in an untyped language, you don't need more or even different tests. Why? Because your in either world your boundaries are untrusted (and more than likely untyped) and then everything internal you can trust. User data, external systems, possibly internal systems, queues, storage..all that data is going to be varying degrees of unsafe and untyped. Those entry/exit points need to be fuzzed, unit and integration tested.
Again, I don't you're wrong, I just think you want/need the tests anyways (because typing isn't remotely enough).
- nicoburns 8y ago> then everything internal you can trust I'd argue that what an expressive type system gives you is precisely this trust that internal data is passed around correctly. In a dynamic langauge it's much easier to pass the wrong argument to a function, and I'd probably want to test for that...
- je42 8y agobut these errors are usually so trivial, that any good integration test would find them any way...
- DCoder 8y agoHow long does your integration test take to run and report failures? Compared to instant feedback while you're writing the code, that's glacial.
- je42 8y agoi assume, so you are doing then doing manual tests after you are done coding ?
- scrollaway 8y agoDo you write tests for every single function call? Every single variable assignment? You don't. Even 100% coverage isn't enough to map all the potential issues with incorrect types being passed around. Types are a highly compact way of adding tests and documentation to your code that automatically integrates with everyone's IDEs and your CI pipeline. I don't know why you wouldn't use it if you think these things are useful. "No thanks, I'd rather spend all my time writing these things I could write much faster using simple types."
- je42 8y agotypes also don't cover all issues. otherwise your types proof your code is 100% correct.
- scrollaway 8y agoI feel like you're missing the point and you think you're not.
- je42 8y agoexample: two functions: "sub" and "add". both have type signatures (int,int) -> int yet the types will not help you to proof you are using the functions correctly, and the types are also not helping that the output of these functions is always as promised by the documentation.
- twblalock 8y agoOne could imagine that a type system is actually a set of tests confirming that a function will only accept arguments that are typed according to the function's signature. To confirm this in a dynamic language, one would need to pass every possible permutation of every type available to the language to the function under test, to confirm that a function of, say, (string, int, boolean) would only ever work in the expected manner if the first argument was a string, the second was an int, and the third was a boolean. Have you tried passing every possible permutation of typed arguments to your functions in test cases? If you haven't, then your program is less tested than a similar program written in a typed language. In a typed language you get all of that for free.