3 ms·
> Class invariants — consistency constraints preserved by ev- ery operation on objects of a given type — are fundamental to building, understanding and verifyin
by jstx1 4y ago
> Class invariants — consistency constraints preserved by ev-
ery operation on objects of a given type — are fundamental to building,
understanding and verifying object-oriented programs.
I think calling them "consistency constraints" would have made everything much easier to understand.
Although I'll admit that I have a strong bias against nouns that can also be adjectives in programming terminology (invariant, generic, atomic, primitive etc). There's something about them that makes my brain spin an extra cycle to process them.
- riffraff 4y agoBut "invariant" has application in various areas, e.g. you can have a loop invariant, or function invariant. The concept/wording makes more sense on this case than "loop consistency constraint", and then you get the benefit of the concept carrying over to different places.
- okr 4y agoBack in the day i struggled with the term invariant, same as with pre- and postconditions. Now i am actually quite happy being able to use them. Anyways,when i describe invariant i also say something is in itself consistent or true.
- hinkley 4y agoJava came along with a free compiler and Meyer still insisted on charging for his. That’s what killed Eiffel. And a doomed a generation and a half of devs to shitty object orientes analysis, culminating in Design Patterns, and reaching its absurd conclusion in Enterprise Design Patterns (institutionalized architectural astronautics). Which incidentally was published after Alexander had already moved on to new organizational principles.
- _a_a_a_ 4y agoQuite so; it is invariantly true