On 2009-11-16 10.48, Jacek Sokulski wrote:
There are two possible reservations: 1. The logic of an entity is scattered in many places. From an interaction point of view it is can be an advantage, since the entity participates in interaction through one of its roles, but understanding the whole behaviour of an entity can be difficult (even in the case of one role, the role can require other roles that require still other roles...)
Right, so the DCI view is that it's actually the opposite: the code of the interaction is scattered around when you use OOP. By modeling the interaction explicitly, with roles that relate to it, it becomes possible to "read algorithms" as was done previously with procedural programming. This is essential to creating largescale readable codebases. You care about being able to read the code of an interaction (context+roles) rather than being able to "read a class", which has little to no meaning.
2. State composition - doesn't it introduce all the problems of multiple inheritance, moreover in a hidden form?
As Niclas said, I don't think that applies here, as all of the mixins are "next to each other" as opposed to "in a tree" as with inheritance. AFAIK we're fine on that one. If you have a particular problem that you're worried about, let us know.
I mean dynamic control, i.e. one Person entity may play Manger role other not (although it has potentially this ability). Another point is dynamic roles composition: a person can play possible hundreds of roles, but from the application point of view only several are interesting, but as the application evolves new ones will be needed. How can I add a new role to person entity without changing the existing code?
But that is the same: you let a Person implement Managerable role, and in that you have methods to determine if the particular instance is allowed to play the Manager role, and if so can register/create instances of that Role. The class defines possible roles and instances have actual role.
When you add more roles, yes, you do change the existing code. So what? What is the problem with that?
/Rickard _______________________________________________ qi4j-dev mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/qi4j-dev

