-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Rickard Öberg
Sent: den 19 november 2009 03:19
To: [email protected]
Subject: Re: [qi4j-dev] DCI vs. Qi4i

On 2009-11-18 20.19, Pawel Niemiec wrote:
> My point is that with leaving polymorphism we lose a useful tool of
> abstracting object in a way that is really needed when we don't care
> how object are behaving. For example, assume we have a theatre. In
> this theatre there is a guy that works with a sound. He has to adjust
> sounds for all actors that are playing, so he needs to bring them on
> a stage and listen to what they are playing. With polymorphism he
> could do so:
>
> Actor[] actor = factory.getAllActors();
>
> Int voicePower0 = actor[0].play() Int voicePower1 = actor[1].play()
> ... and so on.
>
> In this case we don't really have to worry about what role an actor
> is playing. We lose that possibility without polymorphism. I'm not so
> familiar with Qi4j yet, so maybe there is some kind of mechanism that
> can be used in such ?

There is no problem at all to do this. Just declare Actor as the 
interface of your composite and then provide different mixin 
implementations:
@Mixins(ActorType1Mixin.class)
interface ActorType1Composite
   extends Actor,EntityComposite
{}

@Mixins(ActorType2Mixin.class)
interface ActorType1Composite
   extends Actor,EntityComposite
{}


I did so and... it doesn't work, I got the following exception
Exception in thread "main" org.qi4j.api.composite.AmbiguousTypeException: More 
than one visible CompositeType implements mixintype 
actorsintheatre.Actor:[interface actorsintheatre.ActorComposite, interface 
actorsintheatre.ActorVanessaComposite]

I've done it with transient composites, does it matter ?
I could maybe send you the whole example code so that you had whole look at it.

When I look in the online documentation there is only "Content goes here..." 
text under Entity Composite link.
Could you maybe look at that by the way ?

Br
/Pawel Niemiec



> According to your next considerations I personally think that the DCI
> Architecture could be solution to that. Due to it objects are just
> actors, that interact in some way with data. I personally think that
> objects exists only in reality. Then we build an object model,
> abstract it, implement this abstraction with some of class (abstract)
> oriented languages and then try to rebuild "objects" again even if we
> don't really need to. What we really need is behavior (role in DCI)
> and data (including states, entities, etc.).

.. and then the interactions between the objects playing the roles. The 
"script".

/Rickard

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

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

Reply via email to