Hey,

On my blog Ted asked about mixin selection overriding. Today this can be 
done like this:
@Mixins(ListablePersonMixin.class)
interface PersonEntity
   extends Listable, PersonEntity
{}
with a customization being:
@Mixins(CustomListablePersonMixin.class)
interface CustomPersonEntity
   extends PersonEntity
{}

If both mixins implement the same interface, then the custom one will 
have precedence.

Teds question was, however, that if you want to replace implementation 
at assembly-time, how do you do it? The above works, but a more flexible 
way would be to use something similar to .withConcerns() in the assembly.

So, instead one would do:
module.addEntity(PersonEntity.class).withMixins(CustomListablePersonMixin.class);

Pro's:
* Give us a very flexible and open-ended assembly-time mechanism
* No subclassing needed for customization. Everything can be done 
programmatically

Con's:
* You can't look at the Composite type and know how it will work. We are 
getting closer to AOP confusion here. But we've sort of already taken 
that step with the .withConcerns(), so this would only be another 
"logical step on the path to hell".
* You therefore NEED the visualizer to figure out what your system looks 
like. The upside is that I think Tonny will do a great job with it!

The extreme case of all of this is that the Composite type ONLY declares 
the interfaces and none of the mixins, which are then supplied using 
.withMixins(). Superflexible and quite unreadable, but possible.

On a related note, I'm in another discussion thread on another forum 
with Trygve Reenskaug (the MVC guy), and he wants to remove as much 
polymorphism as possible, for the sake of readability (i.e. you see a 
method and know what it will do, because there's only one 
implementation). This feature would go against that desire.

WDYT? Is it worth it? What's the usecase?

/Rickard

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

Reply via email to