Please use accessors!
Carl Gundel
morphic at hotmail.com
Sat Jul 31 17:03:14 UTC 1999
>From: Alan Lovejoy <sourcery at pacbell.net>
>Reply-To: squeak at cs.uiuc.edu
<big snip>
>8. Given the above, I would avoid being dogmatic on this
>issue. I think the fact that so many good Smalltalk programmers
>still access instance variables directly, and that code that commits
>this "sin" has lasted unchanged for so long, should cause one to
>at least question whether or not it's all that sinful.
<snip>
Thanks for the brain dump Alan! :-)
I understand the pragmatics of this issue well, but I feel compelled to make
a counterpoint about the above. Code that accesses ivars directly can be
brittle. In particular, code which uses both direct access and accessor
methods on the same ivars can behave in unpredictable ways. Sometimes such
code survives for a very long time because it is brittle and hard to
understand, and no one wants to touch it for fear of breaking it.
I tend to defer writing code which accesses ivars directly until performance
tuning time. I wish I never had to write such code because it hurt the
maintainability and extensibility of my design, but I live in the real world
(oh Bah!).
Thanks again!
-Carl
_______________________________________________________________
Get Free Email and Do More On The Web. Visit http://www.msn.com
More information about the Squeak-dev
mailing list
|