2 ms·
A flag is just a memoized answer to the predicate though.
by onion2k 4y ago
A flag is just a memoized answer to the predicate though.
- derefr 4y agoIf you also explicitly store the FSM state itself, then sure, that's true. But in my experience, in almost all of these cases, the flags are stored in lieu of an FSM state; with the current FSM state implicit as a constraint-solution over the current set of predicate-answers. Which allows for incoherent states, because no FSM is actually being modelled in the business logic — even though the underlying business process the code is supposed to be modelling is inherently one involving state transitions.
- tempodox 4y agoThe risk is that if you have mutually exclusive predicates, a memoized/persisted flag set might be contradictory. You'd need extra code to check that this is not the case. It's just safer to make invalid states unrepresentable.