Tim vs. Accessors

tim Rowledge tim at rowledge.org
Sun Oct 7 17:14:36 UTC 2007


Ralph pretty much nailed my reasons for disliking the idea of always  
making accessors methods for instvars. I can't vouch for the  
refactoring browser though because I've never actually used it. Or  
even seen it so far as I can remember...

What really upsets me is seeing code like this:-

thisPerson officeLocation office location x: otherPerson  
officeLocation office location x + 12.

a) it looks awful
b) it is a direct transcription of the vile dot-notation from C (and  
other awful languages) that simply pillages structures on the  
assumption that you are refering to memory llocations
c) it assumes a static structure - any change in the structure of  
whatever the 'officeLocation' might return will probably break the code
d) it (obviously) completely ignores any idea of encapsulation

There's way too much code like this floating around. I'm sure I've  
even perpetrated some of it. Yuck.

tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Oxymorons: Software documentation





More information about the Squeak-dev mailing list