[otj-users] Baseclass Generalization
Stephan Herrmann
stephan at cs.tu-berlin.de
Mon Jul 14 12:33:05 CEST 2008
Hi,
A recent question by Miguel reminded me that we indeed discussed this same
issue a long time ago. The question is: If a hierarchy of role classes is
used to map a set of unrelated base classes onto the same abstract role
how can a team method be written that accepts
"any base object that is actually the base of (a subclass of) the role"
?
Well, inspired by a wonderful ECOOP'08 I found that the above can actually
be expressed directly with just a little addition to the type system:
The desired set of types is captured by a type parameter:
<AnyBase base AbstractRole>
The pattern for using the new feature is described here:
http://trac.objectteams.org/ot/wiki/OtPatterns/BaseclassGeneralization
A priliminary definition can be found here:
http://www.objectteams.org/def/1.2/s2.html#s2.3.2.e
Initial tests are also present:
positive:
http://www.objectteams.org/distrib/jacks/1.2.1/results/A.1.9-otjld-basetype-parameter-1.html
negative
http://www.objectteams.org/distrib/jacks/1.2.1/results/A.1.9-otjld-basetype-parameter-2.html
http://www.objectteams.org/distrib/jacks/1.2.1/results/A.1.9-otjld-basetype-parameter-3.html
http://www.objectteams.org/distrib/jacks/1.2.1/results/A.1.9-otjld-basetype-parameter-4.html
The current build including the new feature can be installed from this update-site:
http://www.objectteams.org/distrib/otdt-updates-1.2-cur
@Olaf: sorry, JUnit support still not included. Coming real soon.
@Miguel: would you like to update your Observer-Example and contribute it as a new
example for OT/J demonstrating (among others) the use of this new feature?
As always: any feedback is very welcome!
regards,
Stephan
More information about the otj-users
mailing list