> Second part of the answer: how to model roles, state and entities.
>
><snip>
> interface WorldObjectEntity
> extends Describable, EntityComposite
> {
> interface WorldObjectState
> extends Describable.DescribableState, ...
> {
> }
> }
> ---
> <snip>
> There is no way to cast a Describable to WorldObjectState, so it is
> entirely internal.
Thank you. That's what I think I have been aiming for so far. I expect my
project to be used as a framework (if it ever manages to actually take off,
hehe), so I think I would need to go for the purist version. I really must make
it as hard as possible for outsiders to run bad or malicious code. Of course I
understand that theoretically it is impossible (or quite near to that) to make
a fully robust, malicious-code-proof program. But designing a sound framework
certainly rules out most of the people "feeling lucky". :)
> <snip>
> For the domain API of your object you can also opt to have a
> superinterface that brings it all together:
> interface WorldObject
> extends Describable {}
>
> interface WorldObjectEntity
> extends WorldObject, DescribableState, EntityComposite {}
>
> Actually this is what my code looks like right now. But as I write this
> I'm thinking: "when would I want to refer to my Entity as a WorldObject
> and not through one of its Roles?" and can't come up with any answer...
>
> These are the main options that you have, and that I have found to be
> useful and scalable.
Maybe "WorldObject" is kind of "role" by itself, being many other roles. It
might be useful to tie several roles together. Might save "are these different
roles references to same object" checks later somewhere. :)
_________________________________________________________________
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.
http://www.microsoft.com/windows/windowslive/products/photos.aspx_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev