[MCP] [Q] Color change notification
Bill Spight
Xbspight at pacbell.net
Sun Mar 16 17:48:16 UTC 2003
Dear Diego,
Hannes:
> > What is the benefit of having two methods
> > instead of one
> >
> > color: aColor
> > onColorChange
> >
> > Is it to more clearly show non-standard behavior?
>
Diego:
> The idea is to give more semantic value to the message names. Some code on
> #onColorChange clearly shows an intention to the reader.
Well, "#color: aColor" tells me that I am making the color of the Morph
aColor. Since I know that initialization gives the Morph a default color
(or should, from the method comment), I also know that I am changing the
Morph's color. "#onColorChange" tells me more plainly that I am changing
the Morph's color, but without telling me to what color. If I am reading
that, I may know what color, or I may not care. Or I may scratch my head
and go looking for that information. It introduces a level of
indirection, which may be a good thing for other reasons, but increases
the cognitive complexity of the whole thing, if but by a tiny bit.
Best,
Bill
More information about the Squeak-dev
mailing list
|