Representation Invariant
rep invariants = the bits of the data structure things that are always true; do not vary, unchanging
An object invariant, or representation invariant, is a computer programming construct consisting of a set of invariant properties that remain uncompromised regardless of the state of the object.
This ensures that the object will always meet predefined conditions, and that methods may, therefore, always reference the object without the risk of making inaccurate presumptions. Defining class invariants can help programmers and testers to catch more bugs during software testing.
In CS138, we saw that we can check the rep invariants with the isWellformed
function during the pre-condition and post-condition.