3 ms·
The benefit of building checks into our languages (like static typing, design by contracts, etc.) is that they let you focus on higher level concerns. If I hav
by Jtsummers 9y ago
The benefit of building checks into our languages (like static typing, design by contracts, etc.) is that they let you focus on higher level concerns.
If I have a language that will let me say that a Foo is one of {1,2,3} and will never allow any other integer variable's value to be put into a Foo variable (without explicit casting), I can now focus on my use of Foos and not have to add a type invariant test to every function that consumes or produces a Foo. This doesn't make me less disciplined. It shifts the discipline.
The disciplined programmer can spend all day putting in type invariant checks on their code. Or the disciplined programmer can spend 5 minutes determining what types they need to use, and spend the rest of the day writing out the actual business logic instead of a shit ton of boiler plate code and/or unit tests (which are hopefully comprehensive enough to catch these errors).