Separate Query from Modifier
You have a method that returns a value but also changes the state of an object.
Create two methods, one for the query and one for the modification.

For more inforamtion see page 279 of Refactoring
You have a method that returns a value but also changes the state of an object.
Create two methods, one for the query and one for the modification.

For more inforamtion see page 279 of Refactoring