Reduce permutations, reduce bugs
It’s tempting to add another boolean as a function parameter. Or as a property/member/state variable. It’s just a simple flag, right?
bool isSuper;
bool isDemo;
bool canAccessFeatureAwesome;
bool isStudent;
bool debugMode;
These five variables produce 2^5 (32) possibilities - possibilities you need to test and support. With this increase in possibilities comes an increase in risk of bugs. I realize this is a contrived example, but after enough projects you have probably seen something trending this way or worse!
You could assert that certain combinations shouldn’t happen. It’s better to collapse individual flags into states that are more descriptive and limited to the intended ranges. Push flags further down scope, create pure functions where possible.
Reducing permutations reduces the possibilities of bugs. So does reducing code!