3 ms·
> The easy way out is to say that invariants are “observable” properties and nothing can observe the broken invariant in the middle of the method call. Which i
by Joker_vD 4y ago
> The easy way out is to say that invariants are “observable” properties and nothing can observe the broken invariant in the middle of the method call.
Which is why object's private/internal methods in general should not calling its public methods: public methods are usually written in the way that expects the object to be in a consistent state at the start of the call, and in the middle of a private/internal method it very much likely is inconsistent.
That's something I've personally been burned with and learned the hard way. Know thy methods' preconditions!