Social roles, from agents back to objects
Matteo Baldoni, Guido Boella, Leendert van der Torre · 2005
Abstract — In this paper we introduce a new view on roles in Object Oriented programming languages. This view is based on an ontological analysis of roles and attributes to roles the following properties: first, a role is always associated not only with an object instance playing the role, but also to another object instance which constitutes the context of the role and which we call institution. Second, the definition of a role depends on the definition of the institution which constitutes its context. Third, this second property allows to endow players of roles with powers to modify the state of the institution and of the other roles of the same institution. As an example of this model of roles in Object Oriented programming languages, we introduce a role construct in Java. We interpret these three features of roles in Java as the fact that, first, roles are implemented as classes which can be instantiated only in presence of an instance of the player of the role and of an instance of the class representing the institution. Second, the definition of a class implementing a role is included in the class definition of the institution the role belongs to. Thirdly, powers are methods of roles which can access private fields and methods of the institution they belong to and of the other roles of the same institution. I.