[Newbies] Are setters a good idea?
Blake
blake at kingdomrpg.com
Sun Sep 28 20:37:31 UTC 2008
On Sun, 28 Sep 2008 13:27:52 -0700, Blake <blake at kingdomrpg.com> wrote:
>
> If you're going to assign an action verb to a setter, it should be
> reflective of the process.
>
> donut := Donut makePlain.
> donut ice: #chocolate.
> donut addSprinkles: jimmies atRandom.
Looking at this again, it doesn't seem very illustrative.
What I mean is that if you're going to assign an action verb like
sprayPaint, there should be some reason that it's =not= "color", i.e,
that it reflects some other aspect of the process besides changing the
color. For example,
car color: #red.
says to me, "the color is red, whatever it was before is no more." We're
divorcing the code from physical reality (which is perfectly fine and
usual in most cases).
Other action verbs should be indicative of either the logical process we
want the client to be aware of or a physical reality that we're modeling
More information about the Beginners
mailing list