From: James Coplien Date: 2010-02-17T02:22:22+09:00 Subject: Re: "Code must be Chunkable" > I did a couple of interesting things (though I suppose I may be taking > it too far) I thought of a Context as a Scene in a play, in which I > defined the roles upfront (ie. at the class level) -- I use the Anise > gem to do this, btw. And, despite what was said in the lecture, I was > able to use polymorphism with regard to the roles. This approach seems > very interesting. I was able to define two methods of the same name > that can act on the same object, but dependent on the role it plays. > Thus the Context has a method that is dispatched to all the roles. > While my code is from perfect the approach itself does seem like it > could be useful for large applications. (It feels like overkill for > small libraries though). Right! This is the metaphor we often have been using. More precisely, the Context is a combination of the script (which is in the roles within its scope) and the casting (the dynamic mapping of roles to objects/actors). I in fact have been working on a DCI pattern language based on this metaphor, because it works so well. -- Posted via http://www.ruby-forum.com/.