Hey,
Here's suggested reading:
http://heim.ifi.uio.no/trygver/2008/commonsense.pdf
In it Trygve Reenskaug (MVC inventor) describes DCI (Data, Context and
Interactions). This is a great paper for understanding what and how COP
fits into a bigger picture, and how it enables true OOP.
There's a couple of interesting points with regard to Qi4j. For example,
in order to promote readability he suggests that "each roles has only
one implementation", which in Qi4j terms translate into each mixin type
having only one mixin implementation. Therefore the following pattern
would be recommended:
@Mixins(FooRole.FooMixin.class)
interface FooRole
{
void doStuff();
public class FooMixin
implements FooRole
{
void doStuff() {....};
}
}
DCI also says that the object has two parts: the data and the roles. In
Qi4j/Entity terms this translates into (for example:
interface AccountEntity
extends MoneySourceRole,MoneySinkRole,EntityComposite
{
interface AccountState
{
Property<Money> balance();
}
}
--
The state is only supposed to have data accessors (check), and each role
only has one mixin (check, mixin implementation is specified in the role
itself and the impl uses AccountState directly). The interaction is also
only through roles (check, since AccountState is a private mixin as the
AccountEntity does not extend it).
There are more interesting things in the paper, such as the description
of contexts, interactions and the environment. But the above is, I
think, an interesting example of how COP/Qi4j seems really fit for
implementing the DCI ideas.
/Rickard
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev