News for hackers. Stuff that matters.
Re:Pretending OOP Never Happened by Jtsummers on Friday May 15, 2020 @01:48PM (#23195054)
OOP encourages modifying an object's state via its member functions (if you use data hiding/encapsulation as part of your OOP definition). This means that users of class instances shouldn't be able to put it into a bad state, unless the member functions are able to put it in a bad state.

This lets you isolate where your contract/invariant violations are more easily. Once addressed in the member functions, either it fixes it in the callers, or their use is now invalid and becomes a compile or runtime error.

There are no comments on this comment yet.