Hi,

Through the object-composition mailing list, which discusses DCI a lot, I've come to suspect that it might be important for us to allow public mixins to be added which are additionally added to the proxy of the composite.

Specifically, in DCI you would want to declare an Entity as having only Data interfaces, with CRUD operations and any other Data related operations, and then add Role mixins "on top" when needed by Contexts. As it is one would have to change the EntityComposite declaration to include these roles. Example:
interface FooEntity
   extends EntityComposite, FooData, Foo
{
}
---
If FooData contains the data, and Foo is a particular role used by a particular context, then FooEntity is tightly coupled to that context and those roles. If we instead allow mixins to be declared and exposed through assembly, this coupling goes away. We already have .withMixins() in the assembly, but previously this did not cause interfaces of those mixins to be publically exposed. Example:
module.addEntities( FooEntity.class ).withMixins( FooMixin.class );
--
With the above, if FooEntity extends the interface of FooMixin (e.g. Foo) then the proxy for the entity would implement Foo, otherwise not.

I suggest that this is changed so that the interfaces implemented by mixins declared in the assembly are also exposed. The above would then lead to a proxy which implements "FooEntity" *and* "Foo", and can be cast between these two as necessary. That would allow new contexts and roles (corresponding to new usecases) to be added without having to change the entity definition, which would be good (I think).

The reasonable alternative would be to use extended entity declarations, such as:

interface DomainFooEntity
  extends EntityComposite, FooData
{
}

interface ApplicationFooEntity
  extends DomainFooEntity, Foo
{
}
--
Which already works today.

Any thoughts on this?

regards, Rickard

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

Reply via email to