User Tools

Site Tools


Can a Role be played by several different objects in a given Context instantiation?

No. All Roles are bound as an atomic operation before an Interaction starts. And the Role being an alias for a single object, means that there can only be one object per Role during an Interaction.

Why is switching (rebinding during Interaction) a problem? It creates a conflict with the mental model. Objects in a certain context must be the same as they were at all points during an Interaction. If you write a Use Case for example, any object referred to in the beginning must be the same at the end, for consistency reasons. The same goes for Contexts (and a goal with DCI is to map Use Cases to code.)

A somewhat halting analogy of the above confusion: Imagine switching your favorite James Bond actor for your least favorite during the same movie.

Note: The Roles can all be rebound before another Interaction in the same Context occurs.

can_a_role_be_played_by_several_different_objects_in_a_given_context_instantiation.txt · Last modified: 2014/03/11 13:35 by gazoot