Question

I know there's a technical term for this and for the life of me I can't remember it:

When designing a class (or some kind of thing with a functions and data), each call to the object's methods should leave the object's data in a consistent state. "Consistent" means in accord with a series of (hopefully documented, usually not programmed in) constraints called [X]s.

Was it helpful?

Solution

I think you're getting at "invariants".

Preconditions are things that must be true prior to a method execution. Invariants are things that are always publicly true, and post-conditions are things true following method execution.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top