3 ms·
Precondition (called invariant here): a set of conditions that must be met in order to call a method. Another name for argument validation, but it can be other
by zamalek 8y ago
Precondition (called invariant here): a set of conditions that must be met in order to call a method. Another name for argument validation, but it can be other things (e.g. connected must be true before calling methods on a connection).
Postcondition: guarantees that a method makes. For instance, it won't return null.
Invariants (incorrectly used): conditions that always hold true on a type, e.g. the starting index on a slice must always be greater or equal to zero.
https://en.m.wikipedia.org/wiki/Design_by_contract https://en.m.wikipedia.org/wiki/Design_by_contract
I guess D is guessing via implications, but from what you've said it can't support invariants, meaning it doesn't strictly qualify as DbC.