14.1.1. The use of states
What good is the notion of state? It turns out there are three good uses we can put states to:
-
Sometimes we want to be notified if a context or role enters a particular state. A prime role state example concerns presence. We say an end user is present in a context instance if he or she has opened that context on screen (that is, if there is a presentation of his/her perspective on that context instance on screen). Think of a Chat. We want to be notified whenever our conversational partners ‘enter the room’, so to say.
Notification is a user interface event. -
There may be things that we want to happen automatically whenever a context or role enters or leaves a state. These are precisely the ‘bots’ we make part of our Perspectives models. We can think of bots in terms of rules with a condition (left hand side) and action (right hand side); but we can also view that condition as a state query and think of the action as something to be executed as the context enters that state
As a matter of fact, thinking in terms of state uncovers something that has eluded us until now: that we might have use for a rule variant that fires when its condition switches from true to false, instead of when it switches from false to true. This corresponds, obviously, to leaving and entering a state.].
-
Last, but not least, we may want to model that a perspective only holds in a given state. An example: in a medical context, some information is only useful when the patient is male (so we want to suppress certain form fields for females).
We can think of this as user interface state and changes.