2 ms·
I'm not sold on this, but I can see what the author is trying to say. It would have been good for him to make a concrete argument rather than one based on theor
by DanielBMarkham 18y ago
I'm not sold on this, but I can see what the author is trying to say. It would have been good for him to make a concrete argument rather than one based on theory.
For instance, on several projects I've had code that used getters/setters all over the place. But there was no direct access to private variables. When I was debugging and had a private variable in a bad state, I just set the break point on the setter -- caught the bug every time.
Now maybe I'm out of whack, but I'd like to see another concrete example on the other side. I get the whole noun/verb deal -- heck, I teach it. But what I'm interested in is how exactly Object.Property breaks encapsulation? After all, the caller has no idea how the underlying storage/retrieval is executed.
There is a minimalist philosophy here -- only do what you have to do. I think that's the best argument he has. But he didn't specifically call it out.
- brooksbp 18y agoTrue. The author does not draw the line between using getters/setters and other methods to access data. I guess this is the motivation for ideas such as "leaky abstractions."