[otj-users] Develop Teams independent of base classes
Stephan Herrmann
stephan at cs.tu-berlin.de
Sat Jan 19 16:19:06 CET 2008
> Have you ever thought about passing the playing base class as type
> parameter when instantiating a team? E.g. like the following:
>
> public team class MyTeam <T> {
> protected class MyRole playedBy T { .. }
> ..
> }
>
> MyTeam t = new MyTeam<BaseClass>()
That's an interesting idea ;-)
Some questions:
+ What benefits do you expect from declaring "playedBy T"?
It seems that the role still can't define any method bindings,
without knowing its actual base class?
+ What benefits do you see in instantiating the team type with a type parameter
rather than using inheritance? Do you have any use case in mind, where this
would help?
> Do you consider it to be feasible on OT/J?
My quick answer without analyzing all the details is:
It _could_ be feasible, but it will definitely be hard to realize.
I guess the whole thing would make sense only if we support
public interface ISomeBase {
void foo();
}
public team class MyTeam <T extends ISomeBase> {
protected class MyRole playedBy T {
foo -> foo; // base class is known to have a foo method due to type bound ISomeBase
}
..
}
How would this differ from
public team class MyTeam {
protected class MyRole playedBy ISomeBase {
foo -> foo;
}
..
}
?
Both variants require that we could bind a role to a base _interface_,
which is an open issue mentioned even in the OTJLD §2.1.1.
If we come to the conclusion that parametric teams are a very desirable feature,
this would definitely raise the priority of playedBy interface.
Stephan
More information about the otj-users
mailing list