top | item 45057606

(no title)

baw-bag | 6 months ago

Please if you are in this situation do not take this advice. You just generate massive garbage abstractions upstream. If boolean arguments are out of hand, the problem isn't the boolean.

discuss

order

nurettin|6 months ago

Isn't that the point? If booleans are out of hand, either you are trying to emulate a state machine or you are lacking enums. Or in case of 20 bool parameters, just make it a struct. Nobody will complain.

astrange|6 months ago

Everyone's always trying to emulate a state machine - OOP objects are kind of just an unsafe informal state machine implementation.

Oddly, almost noone has tried providing actual state machines where you have to prove you've figured out what the state transitions are.