3 ms·
Problem is developers take that as an excuse to make state public, which is even worse.
by UK-AL 11y ago
Problem is developers take that as an excuse to make state public, which is even worse.
- kasey_junk 11y agoIt doesn't matter whether you make the state public via a getter or via variables (modulo some compiler specific reasons to use accessors). If your design is allowing some external actor to work with multiple parts of the state of a behavior driven object (ie not a record) accessors are not going to help you, you've still exposed the state.
- UK-AL 11y agoCompletely agree. But at least with getters/setters you can intercept calls before they modify state. But you should design so you don't need this in the first place.