3 ms·
I've never gotten anything more out of DbC than it being assertions and if-statements, but described using fancy English. I even worked with the creator of C4J
by mrkeen 3y ago
I've never gotten anything more out of DbC than it being assertions and if-statements, but described using fancy English. I even worked with the creator of C4J a few years ago.
- mempko 3y agoThe primary benefit imo is * Way of thinking and discipline. Instead of adhock assertions, you deliberately state in code "These are the preconditions, invariants, and postconditions" of this function/module * Better error messages. * Better documentation (can automate extracting the contracts as documentation). * Better tooling. Can automate creating tests from preconditions. You can sample the functions input space and make sure invariants and postconditions hold. It's like, do you name all your functions 'func a1, func a2, func a3' or do you provide better names?