There is a lot of talk about what getters and setters are “evil” and what is not.
My question is: the next evil setter? (the rest of the class is omitted for brevity)
int balance
public void deposit(int amount)
{
this.balance += amount;
}
This class emulates ATM. In the UK there are several ATMs that allow you to make deposits and also withdraw, so this object needs to change its state (balance). Is this setter evil?
eric
source
share