When exactly does a method have side effects?

Posted by Kim on Stack Overflow See other posts from Stack Overflow or by Kim
Published on 2009-05-01T05:27:23Z Indexed on 2010/06/05 11:42 UTC
Read the original article Hit count: 275

As I always understood it, any change to the programs state (or anything to do with IO) is a side effect. It does not matter, whether the change occurs in a global variable or in a private field of the object the method is called on. It follows that all methods which do not return anything either do nothing at all or have a side effect.
My confusion comes from one of our university's instructors (who is still a student and thus not omniscient yet;) ) telling me setters don't have side effects.

© Stack Overflow or respective owner

Related posts about language-agnostic

Related posts about oop