On Sat, 27 Sep 2008 20:47:39 -0700, Ralph Johnson <[EMAIL PROTECTED]> wrote:

On Sat, Sep 27, 2008 at 1:40 PM, Andy Burnett
<[EMAIL PROTECTED]> wrote:
I read somewhere - can't remember where - that setters are considered evil.

This is not a good argument.  Many Smalltalk objects are not modeled
after the real world.  Even if they are, is there really any
difference between sprayPaint: aColour and colour: aColour?

Setters are neither good nor evil.  It is how you use them that is
good or evil.  Many people overuse setters.  I try to avoid setters
because it is harder to tell where a variable is modified if there is
a setter.  But sometimes they are just what you need.

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.

IMO.
_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to