This shows you the differences between two versions of the page.
how_do_i_code_recursive_system_operations_in_dci [2014/01/20 00:29] gazoot created |
how_do_i_code_recursive_system_operations_in_dci [2014/12/05 14:04] (current) jcoplien |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== How do I code recursive system operations in DCI? ====== | ====== How do I code recursive system operations in DCI? ====== | ||
- | There is nothing special about recursion in DCI; it can be done where it's deemed useful. | + | There is nothing special about recursion in general in DCI, it can be done where it's deemed useful. It's important to remember however, that [[can_a_role_be_played_by_several_different_objects_in_a_given_context_instantiation|Roles cannot be rebound during a System operation]] and its following Interaction. |
+ | |||
+ | If you do a recursion on a whole System operation though, it's common that you want to rebind Roles at the recursion point. There are a few ways of doing that: | ||
+ | |||
+ | - Instantiate another Context at the recursion point, and call its System Operation | ||
+ | - Call the atomic "Bind Roles" method right before calling the System Operation again. | ||
+ | |||
+ | The choice is implementation- and convention-based. If you bind Roles only in the constructor, the first option could be more convenient. | ||
+ | |||
+ | Multiple calls to the "Bind Roles" method may not be a good idea. See: [[Can I rebind roles to objects multiple times over the lifetime of a Context object?|Can I rebind roles to objects multiple times over the lifetime of a Context object?]] |