3 ms·
The purist side of me agrees with the author. I try to design my objects around behaviors and make them appear stateless to other objects and other developers.
by gills 18y ago
The purist side of me agrees with the author. I try to design my objects around behaviors and make them appear stateless to other objects and other developers.
But sometimes you just need a data cow, and when the language makes you use objects you don't have much choice but to get/set.
- gills 18y agoAs an added bonus, sometimes the get() will do something more interesting in a subclass, like query a piece of hardware or a remote sensor. In that case you want the getter as interface so that the client can ignore the underlying complexity.