[Newbies] Are setters a good idea?

K. K. Subramaniam subbukk at gmail.com
Mon Sep 29 04:06:28 UTC 2008


On Sunday 28 Sep 2008 12:10:37 am Andy Burnett wrote:
> I read somewhere - can't remember where - that setters are considered evil.
> The argument was that in the real world you can't suddenly change the
> colour of a car, just by settings its colour value. Instead, you have to
> perform some action, e.g. sprayPaintCar: aColour.
I don't recall ever seeing the word 'setter' in blue book. In Smalltalk, you 
only send messages to the object. The sender has no control over the send's 
effect on the internal variables of an object.

The question itself is mischievous :-).

Subbu


More information about the Beginners mailing list