[Newbies] Are setters a good idea?

Andy Burnett andy.burnett at knowinnovation.com
Sat Sep 27 18:40:37 UTC 2008

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.  Therefore in the OO world, one
should tackle problems in the same way, i.e. if you want to change the value
of an instance variable, you have to call some sort of action method, that
makes sense in the context of the object.

Without wishing to send  startHolyWar to BeginnersList, do any of the
experienced developers work this way, or is it just a theoretical position?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20080927/3636c19b/attachment.htm

More information about the Beginners mailing list