Evilness object oriented approach in Morph

Michael Rueger m.rueger at acm.org
Mon Jan 23 07:52:10 UTC 2006


Hilaire Fernandes wrote:

>>I hear this argument over and over again, but I tend to disagree about
>>its "evilness". After all, OO is all about *encapsulation* therefore you
>>shouldn't really care about whether a class accesses its *own* iVars via
>>messages or directly. It is only when subclassing comes into play that
>>this causes problems, and perhaps, just perhaps, subclassing is at the
>>root of that evilness? After all it's the subclasses that try to
>>"extend" (some might say "violate") the well-defined behavior of its
>>superclass.
> 
> 
> Yes, you are right this cause trouble only when I need to extend some of
> the behavior of some attributes. For example, I need a polygon border to
> behvave a bit differently depending on the context of the application.
> But as usual there are workaround and different way to do one think.

I actually disagree. Encapsulation to me also means that you shouldn't 
know if a value is in an iVar or computed. Refactoring to change the use 
from an iVar to something computed or delegated is a hell of a lot 
easier when using message sends. And the almost done jitter will inline 
the return inst vars anyway, won't it? ;-)

Michael



More information about the Squeak-dev mailing list