Hacker News new | ask | show | jobs
by buzz27 1130 days ago
> need incredible amounts of tests to compensate for the lack of compile-time type checking

can you explain this a bit more? it seems to me that test coverage and typing solve different problems.

3 comments

When you lack a type system which catches certain errors at compile-time, you need some other way of catching them. Unit tests are the typical solution.

Give this a watch: https://www.destroyallsoftware.com/talks/ideology

Without compile-time type checking, every single line of code needs to be evaluated with a unit test to ensure there won't be any runtime syntax errors.
If you rename a function, type checking will catch that you rename all usages of it (or fail). With a type system to catch this, you must rely on more complete unit tests to catch anything you forget.

Types do not remove the need for unit tests, but they relieve some pressure from them.