Isolating Side Effects Using Isolation Sets
Isolate side effects by using isolation sets, sets of potentially-pure and fall-through functions that cleanly and simply separate a program’s logic from its side effects.
Potentially pure functions are argument-based higher-order functions (i.e., functions that accept other functions as arguments) with pure function bodies (i.e., function bodies that are consistent and side-effect free), meaning their purity is dependent upon the arguments passed into the function.
Striving to write pure functions (i.e., functions that are consistent and side-effect free) improves the testability, simplicity, and clarity of code.
Fall-through functions, which are simple functions that lack branching constructs (e.g., if/then, switch, etc.), provide the ability to isolate side effects in your codebase.