Tim vs. Accessors

Steven W Riggins mailinglists at geeksrus.com
Mon Oct 8 19:06:30 UTC 2007


On Oct 8, 2007, at 2:27 AM, Michael Rueger wrote:

> And for me using accessors even for local inst vars is enforcing  
> ecapsulation, not the other way round.

This is where I agree with Michael.  Sure ok you can find people  
touching inst vars with a tool, but really, IF performance were no  
issue, only one place should touch the instance variable.

Now part of this might be from my world of never having tools to see  
which code is touching the inst var.  Putting a halt in a setter  can  
often be useless but putting code in that says "hey who is sending me  
this damn Frob when I only expect Wankers" check.

Even in small classes, I have been burnt by := code where I actually  
typoed in TWO places.  Tracking that down was a pain in the neck. :)

encapsulation via obfuscation just seems wrong to me.  There should be  
a better way to denote which methods are private and which are not,  
and have that enforced, or at the very least used as meta data for a  
code coverage/lint like tool.

Computers should work for us, not against us :)



More information about the Squeak-dev mailing list