Object: Identity vs. Environment

Andres Valloud sqrmax at comcast.net
Mon Jun 9 07:04:29 UTC 2003


> But you might have a dozen methods with isFoo + ifTrue/ifFalse.
> Then you would need Object>>fooAction1, Object>>fooAction2, etc.

The dozen actions will get written one way or the other, either inside
ifTrue/ifFalse blocks or in messages.  As far as the amount of code is
concerned, fooActions are at least as compact - if not more since you
don't need ifTrue/ifFalse.

The key issue here is that the ifTrue/ifFalse actions should be in
messages the receivers of isXYZ understand.  Otherwise, the context in
which you write the ifTrue/ifFalse actions has to grow larger to provide
meaning to the actions.  You end up as if you had used a traditional
programming language: the receivers of isXYZ are more value holders than
behaviorful distinctions as far as the context of usage is concerned.

Disclaimer: these arguments apply only to the "isKindOf:" kind of isXYZ
messages.

Andres.



More information about the Squeak-dev mailing list