Stateful and Stateless Models - Gnorion/BizVR GitHub Wiki
Stateful and Stateless Models
Generally, when a decision is executed, data is passed in, the rules execute and a result is returned. Such decisions are considered stateless if they have no knowledge of previous executions.
A stateless decision can always be made stateful by passing in additional information that contains the state but this puts the burden on the rules to figure out where to resume execution. Information about state could also be saved in a database.
This often makes the rules more complex since they now need not only the rules that solve the business problem but also rules to deal with state.
Consider a decision that needs to ask the user questions in order to make a recommendation In a purely stateless model it would need to ask all of the questions up front and then process them to produce a result. In a stateful model model a few initial questions might be asked and then depending on the answers, different questions might need to be asked.
For example in gathering a patient's medical history it makes big difference whether they are male or female. Totally different questions need to be asked. In such a decision there might be rules that make recommendations based on the answers to the questions so far. There might also be rules that determine if additional questions need to be asked.