4 ms·
It’s a really important distinction that the invariant has to be an invariant in the real world (e.g. in the problem domain). Programming “right” is context-dep
by syastrov 8y ago
It’s a really important distinction that the invariant has to be an invariant in the real world (e.g. in the problem domain). Programming “right” is context-dependent.
Some programmers try to program to some theoretically correct ideal, even if it doesn’t apply to their particular problem. Or, they may try to make invariants for things that they think they will need to hold true (possibly because of some future requirement).
All of these can lead people to shy away from having any form of invariants.
Agreeing on what invariants exist in the problem domain at a given time is really important for avoiding confusion. That kind of discussion happens all the time with teams who collaborate well and across disciplines.
“Should it possible for that menu and that modal dialog to be open at the same time?” (Invariant)
“A post can’t be published if it hasn’t been reviewed.” (Precondition)
“After submitting a payment, an audit log entry must be created” (post condition)
- TeMPOraL 8y agoThere aren't many invariants in the real world - beyond literal laws of physics, things that seem invariant are usually enforced by the threat of jail. So in the end, the only real invariants we can use are part of our business model - not the real world - and they only hold insofar our model is specified and implemented correctly.
- deleted 8y ago[deleted]