Comment by hinkley
Comment by hinkley 2 days ago
The way to solve this is to split decisions from execution and that’s a notion I got from our old pal Bertrand Meyer.
if (weShouldDoThis()) {
doThis();
}
It complements or is part of functional core imperative shell. All those checks being separate makes them easy to test, and if you care about complexity you can break out a function per clause in the check.
Functions should decide or act, not both.