Keep accessors and mutators separate

From CSSEMediaWiki
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