Side Effects
- Accessor: no change to object
- Mutator: changes object state
- Side effect: change to another object
-
- Parameter variable
- static object
- Avoid side effects--they confuse users
- Good example, no side effect:
a.addAll(b)
mutates a but not b
previous |
start |
next .... [Slide 25] ....