3 ms·
But I don't want that flexibility! If my state has some invariant, I want to be sure that I can trust it. I don't want to worry that someone will mess with it,
by mattkrause 6y ago
But I don't want that flexibility!
If my state has some invariant, I want to be sure that I can trust it. I don't want to worry that someone will mess with it, breaking the invariant, or accidentally pass in stale state.
If that's all handled automagically by the object, it's out of sight, out of mind. Add in a get_state() and set_state() method if you need it as an escape hatch or for testing.