Evilness object oriented approach in Morph
hilaire at ext.cri74.org
Mon Jan 23 07:21:22 UTC 2006
Andreas Raab a écrit :
> Hilaire Fernandes wrote:
>> I have realized that many of the Morph method does not use instance
>> variable accessor but direct access to the instance variable.
>> One may think this improve the efficiency of the method but in the other
>> hand its downgrade (or just break) the oriented object efficiency of
>> thus objets.
> 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
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.
> Just something to consider.
> - Andreas
More information about the Squeak-dev