2009/11/13 Rickard Öberg <[email protected]>

> On 2009-11-13 16.51, Jacek Sokulski wrote:
>
>> 1. Does it mean there is no (much value in)  inheritance in COP?
>>
>
> Correct, you accomplish much of the same thing using mixins.

Have you tried to implement basic patterns in COP? It should be a good test
for COP expressiveness, as patterns are usually compensation for language
shortcomings.

>
>
>  2. Does it mean e.g properties one usually expect to find both in
>> Manager and Employee like name, department are modelled as separate
>> roles e.g. HasName, InDepartment (then the query findByName can be
>> implemented for all entities with HasName role)?
>>
>
> Correct.

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...)
2. State composition - doesn't it introduce all the problems of multiple
inheritance, moreover in a hidden form?

>
>
>  3. Is  there a mechanism to restrict/define what *actual* roles an
>> entity can play? Or is it the context responsibility to check if a
>> Person can play the Manger role and this info should be part of
>> entity/role state?
>>
>
> The easiest way to do it is to separate between Managerable and Manager
> role, so that a Manager role can only be assigned to an entity that is
> Managerable. You will VERY rarely (if ever) refer to the actual entity
> classes, in preferences of using the role interfaces. This makes it easier
> to read the code and manage dependencies, and also makes it easier to apply
> roles to various entities.
>
> 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?

Jacek
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to