This shows you the differences between two versions of the page.
can_i_rebind_roles_to_objects_multiple_times_over_the_lifetime_of_a_context_object [2014/12/05 14:06] jcoplien created |
can_i_rebind_roles_to_objects_multiple_times_over_the_lifetime_of_a_context_object [2015/11/27 03:49] (current) gazoot Added title, updated formatting |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Can I rebind Roles to objects multiple times over the lifetime of a Context object? ====== | ||
+ | |||
2014-12-05 13:57 GMT+01:00 James O Coplien <jcoplien@gmail.com>: | 2014-12-05 13:57 GMT+01:00 James O Coplien <jcoplien@gmail.com>: | ||
- | Jim Coplien asked Rune, on 5December 2014: | + | Jim Coplien asked Rune, on 5 December 2014: |
//Can you please explain for us why you made such rebinding illegal? :-) I sense some unclarity about this. ;-)// | //Can you please explain for us why you made such rebinding illegal? :-) I sense some unclarity about this. ;-)// | ||
Line 11: | Line 13: | ||
Another example would be that of a computer. Let's say the computer is the context how many role players can I replace with other players before it's a new context? Can I rebind the CPU role? GPU role? the Chassis role? if so can I rebind all of them and still claim it's the same computer? | Another example would be that of a computer. Let's say the computer is the context how many role players can I replace with other players before it's a new context? Can I rebind the CPU role? GPU role? the Chassis role? if so can I rebind all of them and still claim it's the same computer? | ||
- | That's the mental model argument. | + | That's the mental model argument. Another would be based on an example: |
- | + | ||
- | Another would be based on an example | + | |
I have a context with two accounts and I want to transfer money between the two. | I have a context with two accounts and I want to transfer money between the two. | ||
Would I want during the execution of said context that one of the accounts is changed? | Would I want during the execution of said context that one of the accounts is changed? | ||
+ | |||
I'd then transfer out of account A believing the money would go to account B but in between I switched the roleplayer to account C (or at least if the role binding is mutable I don't know if that happened) So if that can happen how do I reason about the code from reading the context source? I need to know how the roleplayers might affect the context during execution however in that case I can only know the roleplayers at compile time if I can solve an NP-complete problem. | I'd then transfer out of account A believing the money would go to account B but in between I switched the roleplayer to account C (or at least if the role binding is mutable I don't know if that happened) So if that can happen how do I reason about the code from reading the context source? I need to know how the roleplayers might affect the context during execution however in that case I can only know the roleplayers at compile time if I can solve an NP-complete problem. |