Keep accessors and mutators separate

From CSSEMediaWiki
Revision as of 03:14, 4 October 2008 by Elliot Fisher (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This is basically the Avoid side effects principle, but specifically applied to Getters and setters.

A getter should only ever return a value and not modify anything. A setter should only ever modify a value and not return anything.

See also

Personal tools