[Newbies] Is it generally considered better practice for an object to access its own variables via its getter methods?

stan shepherd squeak414 at free.fr
Fri Aug 8 12:03:32 UTC 2008



Randal L. Schwartz wrote:
> 
> 
> Whether internal accesses to instance vars should use accessors instead of
> direct access is a subject to debate (read: religious war).  I hope you
> haven't accidentally triggered that thread here. 
> 
> 

There is a nice discussion of the pros and cons of each in:

http://stephane.ducasse.free.fr/FreeBooks/BestSmalltalkPractices/Draft-Smalltalk%20Best%20Practice%20Patterns%20Kent%20Beck.pdf

Pages 68-69.

My summary - direct for clarity, indirect for inheritance.
-- 
View this message in context: http://www.nabble.com/Is-it-generally-considered-better-practice-for-an-object-to-access-its-own-variables-via-its-getter-methods--tp18859170p18890668.html
Sent from the Squeak - Beginners mailing list archive at Nabble.com.



More information about the Beginners mailing list