Discipline for Managing Side Effects
Manage side effects within your code by controlling how and where they occur. Write functions such that if they change state, they do not return values. And if they return values, they do not change state. For example, instead of returning error codes, throw exceptions to indicate a failed state change (such as a database update or user login).