This shows you the differences between two versions of the page.
|
can_roles_be_unbound_in_a_context [2014/01/20 09:05] gazoot |
can_roles_be_unbound_in_a_context [2014/02/03 15:41] (current) gazoot |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Can Roles be unbound in a Context? ====== | ====== Can Roles be unbound in a Context? ====== | ||
| - | No. Having unbound Roles would complicate the Context implementation, forcing checks for that during the execution. If a Role goes largely unused in a Context, it could be a sign that the scope of the Context is too large, or other problems with the underlying mental model. | + | All Roles should be bound as an atomic operation before an Interaction starts, which leaves no place for unbound Roles. If you run into that problem, it could be a sign that the scope of the Context is too large, or other problems with the underlying mental model. |
| - | Note that all Roles are bound as an atomic operation before an Interaction starts. They can all be rebound before another Interaction in the same Context occurs. | + | Note the difference between "unbound Roles" and "Roles set to null". Setting a field that identifies a Role to null is allowed if your language supports it, be aware though that it can complicate things, forcing null checks throughout the Context. |
| + | |||
| + | Also note that the Roles can all be rebound before another Interaction in the same Context occurs. | ||