Boolean parameters are a plague, responsible for non-composable, monolithic functions that never quite do enough, and countless programming bugs:
- "Oops, meant to pass that as the 2nd boolean flag, not the 1st!"
- "Oops, accidentally inverted the meaning of that boolean in the implementation!"
- "Oops, the function isn't flexible enough for my use case, let's add a 6th boolean flag!"
- "Oops, got the meaning of that boolean flag wrong, time to dig into the source code!"
All boolean parameters should be refactored into functions that effect the change otherwise encoded in the parameter.