DEV Community

Discussion on: Static Typing vs Testing == Apples vs Oranges

Collapse
 
samuraiseoul profile image
Sophie The Lionhart

Where have people been advocating that you don't need tests if you have a type system? As your article demonstrates very well, a type system only prevents you from having to write tests that ensure the function only works with the correct inputs types and returns the correct type. Or said perhaps said slightly more eloquently:

Tests should be testing for logic errors. The benefit of the type system is that you no longer have to write tests to validate function inputs and outputs. You still need tests for logic.

Collapse
 
rvprasad profile image
Venkatesh-Prasad Ranganath • Edited

I have been privy to such discussions on social media involving knowledgeable folks taking extreme positions on both sides.

Yes, as of today, each have their strengths and weaknesses. This may change in the future. Until then, it is best to embrace them both :)

Collapse
 
samuraiseoul profile image
Sophie The Lionhart

Do you have any links to someone taking an extreme on either side? I'd like to see their arguments.

Thread Thread
 
rvprasad profile image
Venkatesh-Prasad Ranganath

These were remarks/threads I have seen on Twitter. So, unfortunately, nothing recorded :(

Collapse
 
rvprasad profile image
Venkatesh-Prasad Ranganath

Here's a Twitter thread comparing static typing and testing -- twitter.com/Hillelogram/status/102....

Collapse
 
dmerejkowsky profile image
Dimitri Merejkowsky

By the way if you read his blog you'll also find interesting stuff on this subject and others (like formal proofs)

Thread Thread
 
rvprasad profile image
Venkatesh-Prasad Ranganath

I am not saying Hillel or any static typing proponents are wrong. Having worked on program analysis/verification and formal methods, I am saying we need to have a broader and more permissive perspective. Instead of saying "static typing is the end all", it may be better to understand why we operate the way we do and be pragmatic about what it takes to get from where we are to where we want to be.