§2.5 Abstract Roles

Overriding of role classes and dynamic binding of role types (§1.3.1.(e)) adds new cases to creation with respect to abstract classes.

(a) Using abstract classes for creation

Abstract role classes can indeed be used for object creation. The effect of such a statement is that the team must be marked abstract. Only those sub-teams are concrete that provide concrete versions for all role classes used in creation expressions.
This includes the case, where a super-team has a concrete role class and creates instances of this role class and only the sub-team changes the status of this role class to abstract. Also here the sub-team must be marked abstract, because it contains an abstract role class that is used in creation expressions.

Interpretation:
Since the type in a role creation expression is late-bound relative to the enclosing team instance, abstract role classes can be seen as the hook in a template&hook pattern that is raised from the method level to the class level: A super-team may already refer to the constructor of an abstract role class, only the sub-team will provide the concrete role class to fill the hook with the necessary implementation.

(b) Relevant roles

A team must be marked abstract if one of its relevant roles is abstract.
A role is relevant in this sense if

  • the role class is public or if
  • an explicit new expression would require to create instances of the role class, or if
  • any of the lifting methods of the enclosing team would require to create instances of the role class.
    A role is irrelevant with respect to lifting if either of the following holds:
    • It is not bound to a base class, neither directly nor by an inherited playedBy clause.
    • It has a sub-role without a playedBy clause.
    • It is bound to an abstract base class, and for all concrete sub-classes of the base class, a binding to a more specific role class exists.

If neither property, relevance nor irrelevance, can be shown for an abstract role, a warning is given in case the enclosing team is not abstract.