====== 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 : 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. ;-)// ---- I gave an example in Oslo on why I think rebinding conflicts with my personal mental model of a context. If you, Trygve and I are discussing DCI we can take certain things for granted. We have a pretty good idea of where we differ in opinions and where we share mental models. That gives us a way of understanding how the context execute. If you replace me with Matt you have a similar idea of view points but you can't use the reasoning from the first context to understand the second. 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. Another would be based on an example: 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? 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.