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.

Était-ce utile?

La 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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top