5 ms·
> My answer to that question has always been that data hiding is necessary for the sake of modular independence in large systems. Yes. But not on a granularity
by dpc_pw 6y ago
> My answer to that question has always been that data hiding is necessary for the sake of modular independence in large systems.
Yes. But not on a granularity of every object. Just like you don't put a padlock on every pocket, to protect your left hand from grabbing stuff from a right pocket.
Hiding data has a real cost, just like inventing abstractions and interfaces for every tiny thing. That's the core reason why OOP-software is so bloated and always feels so "heavy".
The right granularity is much coarse: modules, API layers, data-stores. Much closer to service in "micro-service", than "object".