Importing Agent-like Interaction in Object Orientation Matteo Baldoni, Guido Boella Leendert van der Torre Dipartimento di Informatica Department of Computer Science FTST Università degli Studi di Torino 6, rue Richard Coudenhove - Kalergi C.so Svizzera, 185 — I-10149 Torino (Italy) L-1359 Luxembourg Email: {baldoni,guido}@di.unito.it Email: leon.vandertorre@uni.lu Abstract— This paper begins with the comparison of the for proposal and it must arrive, no matter when, before message-sending mechanism, for communication among agents, a given deadline. and the method-invocation mechanism, for communication 6) The receiver autonomously decides to comply with among objects. Then, we describe an extension of the method- invocation mechanism by introducing the notion of “sender” of the message (e.g., making a proposal after a call for a message, “state” of the interaction and “protocol” using the proposal). notion of “role”, as it has been introduced in the powerJava The message metaphor has been originally used also for extension of Java. The use of roles in communication is shown by means of an example of protocol. describing method calls among objects, but it is not fully ex- ploited. In particular, message-exchange in the object oriented I. I NTRODUCTION paradigm has the following features: The major differences of the notion of agent w.r.t. the notion 1) The message is sent to the receiver without any infor- of object are often considered to be “autonomy” and “proactiv- mation concerning the sender. ity” [27]. Less attention has been devoted to the peculiarities 2) There is no state of the interaction between sender and of the communication capabilities of agents, which exchange receiver. messages while playing roles in protocols. For example, in the 3) The message is independent from the previous messages contract net protocol (CNP) an agent in the role of initiator sent and received. starts by asking for bids, while agents playing the role of 4) The sender and the receiver do not need to play any role participants can propose bids which are either accepted or in the message exchange. rejected by the Initiator. 5) The interaction is synchronous: an object waits for the The main features of communication among agents which result of a method invocation. emerge from the CNP example are the following: 6) The receiver always executes the method invoked if it 1) The message identifies both its sender and its receiver. exists. E.g., in FIPA the acceptance of a proposal is: These two scenarios are rather different but we believe that (accept-proposal :sender i :receiver the object-oriented (OO) paradigm can learn something from j :in-reply-to the agent-oriented world. The research question of this paper is bid089 :content X :language thus: is it profitable to introduce in the OO paradigm concepts FIPA-SL). taken from agent communication? how can we introduce 2) The interaction with each agent is associated to a state in the OO paradigm the way agents communicate? And as which evolves according to the messages that are ex- subquestions: which of the above properties can be imported changed. The meaning of the messages is influenced by and which cannot? How to translate the properties which can the state. E.g., in the FIPA iterated contract net protocol, be imported in the OO paradigm? What do we learn in the a “call for proposal” is a function of the previous calls agent-oriented world from this translation? for proposals, i.e., from the session. The methodology that we use in this paper is to map the 3) Messages are produced according to some protocol (e.g., properties of agent communication to an extension of Java, a call for proposal must be followed by a proposal or a powerJava [4], [3], [5], which adds roles to objects. Roles reject). are used to represent the sender of a message (also known as 4) The sender and the receiver play one of the roles the “player of the role”), to represent the state of the interaction specified in the protocol (e.g., initiator and participant via role instances, allowing the definition of protocols and in the contract net protocol). asynchronous communication as well as the representation of 5) Communication is asynchronous: the response to a mes- the different relations between objects. sage does not necessarily follow it immediately. E.g., in The choice of the Java language is due to the fact that it is the contract net protocol, a proposal must follow a call one of the prototypical OO programming languages; moreover, 158 MAS systems are often implemented in Java and some agent as a primitive of the language. By adopting agent-like com- programming languages are extensions of Java, e.g., see the munication, in fact, the properties presented in Section I – Jade framework [8] or the JACK software tool [26]. In this with the only exception of autonomy, (6), which is a property way we can directly use complex interaction and roles offered distinguishing agents from objects – can be rewritten as in the by our extension of Java when building MAS systems or following: extending agent programming languages. 1) When methods are invoked on an object also the object Furthermore, we believe that in order to contribute to the invoking the method (the “ sender” ) must be specified. success of the Autonomous Agents and Multiagent Systems 2) The state of the interaction between two objects must research, the theories and concepts developed in this area be maintained. should be applicable also to more traditional views. It is 3) In presence of state information, it is possible to imple- a challenge for the agent community to apply its concepts ment interaction protocols because methods are enabled outside strictly agent-based applications. The OO paradigm is to adapt their behavior according to the interaction that central in Computer Science and, as observed and suggested has occurred so far. So, for instance, a proposal method also by Juan and Sterling [19], before AO can be widely used whose execution is not preceded by a call for proposals in industry, its attractive theoretical properties must be first can detect this fact and raise an exception. translated to simple, concrete constructs and mechanisms that 4) The object whose method is invoked and the object are of similar granularity as objects. invoking the method play each one of the roles specified The paper is organized as follows. In Section II we show by the other, and they respect the requirements imposed which properties of agent communication can be mapped to on the roles. Intuitively, requirements are the capabilities objects. In Section III we introduce how we model interaction that an object must have in order to be able to play the in powerJava and in Section IV we discuss how to use roles role. in order to model complex forms of interaction between object 5) The interaction can be asynchronous, thanks to the fact inspired by agent interaction, we also illustrate the contract net that the state of the interaction is maintained. protocol among objects using powerJava. Conclusions end For a better intuition, let us consider as an example the the paper. case of a simple interaction schema which accounts for two II. C OMMUNICATION BETWEEN OBJECTS objects. We expect the first object to wait for a “ call for proposal” by the other object; afterwards, it will invoke the When approaching an extension of a language or of a method “ propose” on the caller. The idea is that the call for method, the first issue that should be answered is whether proposal can be performed by different callers and, depending that extension brings along some advantages. In our specific on the caller, a different information (e.g. the information that case, the question can be rephrased as: Is it useful for the OO it can understand) should be returned by the first object. More paradigm to introduce a notion of communication as developed specifically, we can, then, imagine to have an object a, which in MAS? We argue that there are several acknowledged limita- exposes a method cfp and waits for other objects to invoke tions in OO method invocation which could be overcome, thus it. After such a call has been performed, the object a invokes realizing what we could call a “ session-aware interaction” . a method propose on the caller. Let us suppose that two First of all, objects exhibit only one state in all interactions different objects, b and c, do invoke cfp. We desire the data with any other object. The methods always have the same returned by a to be different for the two callers. meaning, independently of the identity or type of the object Since we look at the agent paradigm the solution is to have from which they are called. two different interaction states, one for the interaction between Second, the operational interface of Abstract Data Types a and b and one for the interaction between a and c. In our induces an asymmetrical semantic dependency of the callers terminology, b and c interact with a in two distinct roles of operations on the operation provider: the caller takes (or better, role instances) which have distinct states: thus it is the decision on what operation to perform and it relies on possible to have distinct behaviors depending on the invoker. the provider to carry out the operation. Moreover, method If the next move is to “ accept” a proposal, then we must be invocation does not allow to reach a minimum level of “ control able to associate the acceptance to the right proposal. from the outside” of the participating objects [2]. In order to implement these properties we use the notion Third, the state of the interaction is not maintained and of role introduced in the powerJava language in a different methods always offer the same behavior to all callers under way with respect to how it has been designed for. every circumstance. This limit could be circumvented by passing the caller as a further parameter to each method and III. M ODELLING INTERACTION WITH powerJava by indexing, in each method, the possible callers. In [24], [1], [13], [22] the concept of “ role” has been Finally, even though asynchronous method calls can be proved extremely useful in programming languages for several simulated by using buffers, it is still necessary to keep track reasons. These reasons range from dealing with the separation of the caller explicitly. of concerns between the core behavior of an object and its The above problems can be solved by using the way interaction possibilities, reflecting the ontological structure of communication is managed between agents and defining it domains where roles are present, from modelling dynamic 159 changes of behavior in a class to fostering coordination among } components. In [4], [3], [5] the language powerJava is Requirements must be implemented by the objects which act introduced: powerJava is an extension of the well-known as players. Java language, which accounts for roles, defined within social entities like institutions, organizations, normative systems, or class Person implements AccountedPerson { Login login; // ... groups [6], [15], [28]. The name powerJava is due to the fact Login getLogin() { that the key feature of the proposed model is that institutions return login; use roles to supply the powers for acting (empowerment). } In particular, three are the properties that characterize roles, } according to the model of normative multiagent systems [10], Instead, powers are implemented in the class defining the [11], [12]: institution in which the role itself is defined. To implement Foundation: a (instance of) role must always be roles inside an institution we revise the notion of Java inner class, by introducing the new keyword definerole instead associated with an instance of the institution it be- of class followed the name of the role definition that the longs to (see Guarino and Welty [17]), besides being class is implementing. associated with an instance of its player. class Printer { Definitional dependence: The definition of the role final static int MAX_PAGES_PER_USER; must be given inside the definition of the institution private int totalPrintedPages = 0; it belongs to. This is a stronger version of the definitional dependence notion proposed by Masolo private void print(Job job, Login login) { et al. [20], where the definition of a role must include totalPrintedPages += job.getNumberPages(); // performs printing the concept of the institution. } Institutional empowerment: the actions defined for the role in the definition of the institution have access definerole User { to the state and actions of the institution and to the int counter = 0; other roles’ state and actions: they are powers. public int print(Job job) { if (counter > MAX_PAGES_USER) Roles require to specify both who can play the role and throws new IllegalPrintException(); which powers are offered by the institution in which the role counter += job.getNumebrPages(); is defined. The objects which can play the role might be of Printer.this.print(job, that.getLogin()); different classes, so that roles can be specified independently return counter; } of the particular class playing the role. For example a role public int getPrintedPages(){ customer can be played both by a person and by an organi- return counter; zation. Role specification is a sort of double-sided interface, } which specifies both the methods required to a class playing } the role (requirements, keyword “ playedby” ) and the methods definerole SuperUser { offered to objects playing the role (powers keyword “ role” ). public int print(Job job) { An object, which plays a role, is empowered with new methods Printer.this.print(job, that.getLogin()); as specified by the interface. return totalPrintedPages; To make an example, let us suppose to have a printer which } supplies two different ways of accessing to it: one as a normal public int getTotalPrintedpages() { user, and the other as a superuser. Normal users can print their return totalPrintedPages; jobs and the number of printable pages is limited to a given } maximum. Superusers can print any number of pages and can } query for the total number of prints done so far. In order to be a user one must have an account which is printed on the } pages. The role specification for the user is the following: Roles cannot be implemented in different ways in the same role User playedby AccountedPerson { institution and we do not consider the possibility of extending int print(Job job); int getPrintedPages(); role implementations (which is, instead, possible with inner } classes), see [5] for a deeper discussion. As a Java inner class, a role implementation has access interface AccountedPerson { to the private fields and methods of the outer class (in the Login getLogin(); above example the private method print of Printer used both } in role User and in role SuperUser) and of the other roles The superuser, instead: defined in the outer class. This possibility does not disrupt role SuperUser playedby AccountedPerson { the encapsulation principle since all roles of an institution are int print(Job job); defined by who defines the institution itself. In other words, an int getTotalPrintedPages(); object that has assumed a given role, by means of it, has access 160 and can change the state of the corresponding institution and of the sibling roles. In this way, we realize the powers envisaged (hp8100 <-(User) chris).print(job1); by our analysis of the notion of role. (hp8100 <-(SuperUser) sergio).print(job2); (hp8100 <-(User) chris).print(job3); The class implementing the role is instantiated by passing to the constructor an instance of an object satisfying the System.out.println("Chris has printed " + requirements. The behavior of a role instance depends on the (hp8100 <-(User) chris).getPrintedPages() player instance of the role, so in the method implementation + " pages"); the player instance can be retrieved via a new reserved key- System.out.println("The printer hp8100 has printed a total of " + word: that, which is used only in the role implementation. (hp8100 <-(User)sergio).getTotalPrintedPages() In the example the invocation of that.getLogin() as a + " pages"); parameter of the method print. All the constructors of all roles have an implicit first } parameter which must be passed as value the player of the } role. The reason is that to construct a role we need both the By maintaining a state, a role can be seen as realizing a institution the role belongs to (the object the construct new session-aware interaction, in a way that is analogous to what is invoked on) and the player of the role (the first implicit done by cookies or Java sessions for JSP and Servlet. So in parameter). For this reason, the parameter has as its type the our example, it is possible to visualize the number of currently requirements of the role. A role instance is created by means of printed pages, as in the above example. Note that, when we the construct new and by specifying the name of the “ inner talk about playing a role we always mean playing a role class” implementing the role which we want to instantiate. instance (or qua individual [20] or role enacting agent [14]) This is like it is done in Java for inner class instance creation. which maintains the properties of the role. Differently than other objects, role instances do not exist by An object has different (or additional) properties when it themselves and are always associated to their players. plays a certain role, and it can perform new activities, as Methods can be invoked from the players, given that the specified by the role definition. Moreover, a role represents a player is seen in its role. To do this, we introduce the new specific state which is different from the player’s one, which construct can evolve with time by invoking methods on the roles. The receiver <-(role) sender relation between the object and the role must be transparent to the programmer: it is the object which has to maintain a This operation allows the sender (player of the role) to use reference to its roles. However, a role is not an independent the powers given by “ role” when it interacts with the receiver (institution) the role belongs to. It is similar to role cast as object, it is a facet of the player. introduced in [3], [4], [5] but it stresses more strongly the Since an object can play multiple roles, the same method interaction aspect of the two involved objects: the sender uses will have a different behavior, depending on the role which the the role defined by the receiver for interacting with it. Let us object is playing when it is invoked. It is sufficient to specify see how to use this construct in our running example. The first which the role of a given object, we are referring to, is. In the instructions in the main create a printer object hp8100 and example chris can become also superuser of hp8100, two person objects, chris and sergio. chris is a normal besides being a normal user user while sergio is a superuser. Indeed, instructions four hp8100.new SuperUser(chris); and five define the roles of these two objects w.r.t. the created (hp8100 <-(SuperUser) chris).print(job4); printer. The two users invoke method print on hp8100. (hp8100 <-(User) chris).print(job5); They can do this because they have been empowered of printing by their roles. The act of printing is carried on by Notice that in this case two different sessions will be kept: the private method print. Nevertheless, the two roles of one for chris as normal user and the other for chris as User and SuperUser offer two different way to interact with it: User counts the printed pages and allows a user to superuser. Only when it prints its jobs as a normal user print a job if the number of pages printed so far is less than a the page counter is incremented. given maximum; SuperUser does not have such a limitation. Moreover, SuperUser is empowered also for viewing the IV. U SES OF ROLES IN powerJava total number of printed pages. Notice that the page counter is maintained in the role state and persists through different In this paper we exploit the language powerJava in a calls to methods performed by a same sender/player towards new way which allows modelling the agent inspired vision of the same receiver/institution as long as it plays the role. interaction among objects. The basic idea of powerJava is class PrintingExample { that objects (e.g. hp8100), called institutions, are composed public static void main(String[] args) { of roles which can access the state of the institution and of other sibling roles and, thus, can coordinate with each other Printer hp8100 = new Printer(); [4]. However, since an institution is just an object which Person chris = new Person(); happens to contain role implementations, nothing prevents us Person sergio = new Person(); to consider every object as an institution, and to consider the hp8100.new User(chris); roles as different ways of interacting with it. Many objects can hp8100.new SuperUser(sergio); play the same role (a printer can have many users) as well as 161 the same object can play different roles (chris is both a user of interaction protocols: e.g., an object can play the role and a superuser). Each role instance has its own state, which of initiator in the Contract Net Protocol if and only if represents the state of the interaction with the player of the the other object plays the role of participant. Indeed, the role. Contract Net Protocol is reported as an example in the following section. The four cases can be combined to represent more complex interaction schemas. This view of roles inspires a new vision of the the OO paradigm, whose object metaphor has been accepted too acritically and it has not been subject to a deep analysis. In particular, it is a naive view of the notion of object and it does not consider the analysis of the way humans conceptualize objects performed in philosophy and above all in cognitive science [16]. In particular, cognitive science has highlighted that properties of objects are not objective properties of the world, but they depend on the properties of the agent concep- Fig. 1. The possible uses of roles. tualizing the object: objects are conceptualized on the basis of what they “ afford” to the actions of the entities interacting with Figure 1 illustrates the different interaction possibilities them. Thus, different entities conceptualize the same object in given by roles, which do not exclude the traditional direct different ways. We translate this intuition in the fact that an interaction with the object when roles are not necessary. Other object offers different methods according to which type of possibilities like sessions shared by multiple objects are not object it is calling it: the methods offered (the powers of a considered for space reasons. role) depend on the requirements offered by the caller. Arrows represent the relations between players and their respective roles, dashed arrows represent the access relation A. The Contract Net Protocol example between objects, i.e., their powers. Hereafter, we report an example set in the framework of • Drawing (a) illustrates the situation where an object interaction protocols, describing an implementation of the interacts with another one by means of the role offered well-known contract net protocol. The example follows the by it. This is, for instance, the case of sergio being a interaction schema (d), reported in the previous section, and it SuperUser of hp8100. is substantially different than the analogous example reported • Drawing (b) illustrates an object (e.g., chris) interacting in a previous paper [3]. In fact, the solution proposed here is in two different roles with another one (hp8100 in distributed instead of being centralized (let us denote by this the example). This situation is used when an object name a solution respecting case (c) in the previous section). implements two different interfaces for interacting with The advantage of the old solution was that players did not it, which have methods (like print) with the same need to know anything about the coordination mechanism. signature but with different meaning. In our model the In this case, instead, each object also supplies a role for its methods of the interfaces are implemented in the roles counterpart, which describes the powers that are given to the offered by the objects to interact with them. The role counterpart in the interaction. For instance, the object that represent also the different sessions of the interaction with will play the initiator role will define the powers of the different objects. the participants, and vice versa. The powers are the • Drawing (c) illustrates the case of two objects which messages that the initiator will understand; this is very interact by means of the roles of an institution (which different than our previous proposal, where the powers only can be considered as the context of execution). This is the allowed to start a negotiation or to take part to a negotiation, original case, powerJava has been developed for [4]; in depending on the role, and the exchanged messages were this paper, we used as a running example the well-known hidden inside the institution. 5 philosophers scenario. The institution is the table, at In this new version, roles are also used for main- which philosophers are sitting and coordinate to take the taining interaction sessions. In the following example, chopsticks and eat since they can access the state of each refuseProposal can be executed only if cfp has already other. The coordinated objects are the players of the role been executed, this can be tracked thanks to the role state and, chopstick and philosopher. The former role is in particular, thanks to variable state (set to the constant played by objects which produce information, the latter value STATE 1 or ST AT E 2 to check which operations of the by objects which consume them. None of the players role can be called in which state and under which condition). contains the code necessary to coordinate with the others, Observe that when the object, offering a role, is supposed which is supplied by the roles. to answer something, it needs to invoke a method, which is • In drawing (d) two objects interact with each other, each supplied as a power of a role, which is in turn offered by the playing a role offered by the other. This is often the case object to which it is responding. In the contract net, a possible 162 answer to a cfp is the performative propose. In this case, see also the code reported at the end of this section, the above public void cfp(Task task) { interaction is implemented by the instruction: if (state != STATE_1) throws new IllegalPerfomativeException(); (that <-(Participant) state = STATE_2; Peer.this).propose(getProposal(task)) if (evaluateTask(task)) (that <-(Participant) Peer.this). Here, Peer.this refers to the object offering the role propose(getProposal(task)); initiator; such an object means to play the role of else (that <-(Participant) Peer.this). Participant and, in particular, to invoke the power refuse(task); propose offered by this role. The role participant is } offered by the object which is currently playing the initiator (identified in the above code line by that), see Fig. 2. public void refuseProposal(Proposal proposal) { if (state != STATE_2) Peer Peer throws new IllegalPerformativeException(); removeProposal(proposal); Initiator cfp Participant state = STATE_1; evaluateTask } this public void acceptProposal(Proposal proposal) { propose Peer.this that if (state != STATE_2) throws new IllegalPerfomativeException(); try { Fig. 2. Description of the interaction between an Initiator and a Participant, (that <-(Participant) Peer.this). when, after a “ cfp” performative, the answer will be a “ propose” performative. inform(performTask(proposal, task)); } catch(TaskExecException err) { The communication is asynchronous, since the proposal is (that <-(Participant) Peer.this). not returned by the cfp method. failure(err); Notice that an object which is currently playing the role of } state = STATE_1; participant in a given interaction, can at the same time play } the role of initiator in another interaction. See the method evaluateTask, in which a new interaction is started for } executing a subtask by creating the two roles in the respective objects and by linking players to them: private boolean evaluateTask(Task task) { Task subTask; // ... role Initiator playedby InitiatorReq { this.new Participant(peer); void cfp(Task task); peer.new Initiator(this); void rejectProposal(Proposal proposal); (peer <-(Initiator) this).cfp(subTask); void acceptProposal(Proposal proposal); // ... } } interface InitiatorReq { // must implement the role specification definerole Participant { ... } // Participant } } role Participant playedby ParticipantReq { V. C ONCLUSION void propose(Proposal proposal); void refuse(Task task); In this work, we have proposed the introduction of a form void inform(Object result); of interaction between objects, in the OO paradigm, which void failure(Object error); } borrows from the theory about agent communication. The main advantage is to allow session-aware interactions in which interface ParticipantReq { the history of the occurred method invocations can be taken // must implement the role specification into account and, thus, introducing the possibility of realizing, // Initiator in a quite natural way, agent interaction protocols. The key } concept which allows communication is the role played by an class Peer implements ParticipantReq, object in the interaction with another object. Besides proposing InitiatorReq a model that describes this form of interaction, we have { also proposed an extension of the language powerJava that accounts for it. definerole Initiator { final static int STATE_1 = 1; One might wonder whether the introduction of agent-like final static int STATE_2 = 2; communication between objects gives us some feedback to int state = STATE_1; the agent world. We believe that the following lessons can be 163 learnt, in particular, concerning roles: specific views as role objects which are dynamically attached • Roles must be distinguished in role types and role in- to a core object, thus forming what they call a subject. This stances: role instances must be related to the concept of adjunct instance should share the same interface as the core session of an interaction. object. Our proposal is distinguished by the fact that roles • The notion of role is useful not only for structuring insti- are always roles of an institution. As a consequence they do tutions and organizations but for dealing with interaction not consider the additional methods of the roles as powers among agents. which are implemented using also the requirements of the role. • The notion of affordance can be used to allow agents to Finally, in their model, since the role and its player share the interacts in different ways with different kind of agents. same interface, it is not possible to express roles as partial In this paper, we show a different way of using powerJava views on the player object. exploiting roles to model communications where: the method In UML 2.0 the Protocol State Machine (PSM) was in- call specifies the caller of the object, the state of the interaction troduced to specify which operations of the classifier can is maintained, methods can be part of protocols, objects play be called in which state and under which condition, thus roles in the interaction and method calls can be asynchronous specifying the allowed call sequences on the classifiers oper- as in agent protocols. ations [25]. This diagram is particular useful for representing This proposal builds upon the experience that the au- protocols between objects. Our proposal could help to im- thors gathered on the language powerJava [4], [3], [5], plement a PSM because of the possibility represents directly which is implemented by means of a precompiler. Basically by the notion of role all the message exchanges relevant to powerJava shares the idea of gathering roles inside wider the protocol, increasing the readability and reusability of the entities with languages like Object Teams [18] and Ceasar protocol implementation itself. [21]. These languages emerge as refinements of aspect oriented By implementing agent like communication in an OO languages aiming at resolving practical limitations of other programming language, we gain in simplicity in the language languages. In contrast, our language starts from a conceptual development, importing concepts that have been developed modelling of roles and then it implements the model as by the agent community inside the Java language itself. language constructs. Differently than these languages we do This language is, undoubtedly, one of the most successful not model aspects. The motivation is that we want to stick currently existing programming languages, which is also used as much as possible to the Java language. However, aspects to implement agents even though it does not supply specific can be included in our conceptual model as well, under features for doing it. The language extension that we propose the idea that actions of an agent playing a role “ count as” is a step towards the overcoming of these limits. actions executed by the role itself. In the same way, the At the same time, introducing theoretically attractive agent execution of methods of an object can give raise by advice concepts in a widely used language can contribute to the weaving to the execution of a method of a role. On the success of the Autonomous Agents and Multiagent Systems other hand, these languages do not provide the notion of role research in other fields. Developers not interested in the casting we introduce in powerJava. Roles as double face complexity of agent systems can anyway benefit from the interfaces have some similarities with Traits [23] and Mixins advances in this area by using simple and concrete constructs [9]. However, they are distinguished because roles are used in a traditional programming language. to extend instances and not classes. Finally, C# allows for Future work concerns making explicit the notion of state of multiple implementations of interfaces. None of the previous a protocol so to make it transparent to the programmer and works, however, considers the fact that roles work as sessions allow to define the same method with different meanings in of the interaction between objects. each state. Finally, the integration of centralized and decen- Some patterns partially address the same problems of this tralized approaches to coordination among roles (drawings (c) paper. For example, the strategy design pattern allows to dy- and (d) of Figure 1) must be studied. namically change the implementation of a method. However, it is complex to implement and it does not address the problem R EFERENCES of having different methods offered to different types of callers [1] A. Albano, R. Bergamini, G. Ghelli, and R. Orsini, “An object data and of maintaining the state of the interaction between caller model with roles,” in Procs. of VLDB’93, 1993, pp. 39–51. and callee. [2] F. Arbab, “Abstract behavior types: A foundation model for components Baumer et al. [7] propose the role object pattern to solve and their composition,” in Formal Methods for Components and Objects, LNCS 2852. Berlin: Springer Verlag, 2003, pp. 33–70. the problem of providing context specific views of the key [3] M. Baldoni, G. Boella, and L. van der Torre, “ Bridging agent theory and abstractions of a system. They argue that different context- object orientation: Importing social roles in object oriented languages,” specific views cannot be integrated in the same class, otherwise in Procs. of PROMAS’05 workshop at AAMAS’05, 2005. [4] ——, “ Roles as a coordination construct: Introducing powerJava,” in the class would have a bloated interface, and unanticipated Procs. of MTCoord’05 workshop at COORDINATION’05, 2005. changes would result in recompilations. Moreover, it is not [5] ——, “ Powerjava: ontologically founded roles in object oriented pro- possible either to consider two views on an object as an object gramming language,” in Procs. of OOOPS Track of SAC’06, 2006. [6] B. Bauer, J. Muller, and J. Odell, “Agent UML: A formalism for specify- belonging to two different classes, or else the object would ing multiagent software systems,” Int. Journal of Software Engineering not have a single identity. They propose to model context- and Knowledge Engineering, vol. 11(3), pp. 207–230, 2001. 164 [7] D. Baumer, D. Riehle, W. Siberski, and M. Wulf, “ Proc. of plop’02,” in The role object pattern, 2002. [8] F. Bellifemine, A. Poggi, and G. Rimassa, “ Developing multi-agent systems with a FIPA-compliant agent framework,” Software - Practice And Experience, vol. 31(2), pp. 103–128, 2001. [9] L. Bettini, V. Bono, and S. Likavec, “A core calculus of mixin-based incomplete objects,” in Procs. of FOOL Workshop, 2004, pp. 29–41. [10] G. Boella and L. van der Torre, “Attributing mental attitudes to roles: The agent metaphor applied to organizational design,” in Procs. of ICEC’04. IEEE Press, 2004. [11] — — , “A game theoretic approach to contracts in multiagent systems,” IEEE Transactions on Systems, Man and Cybernetics - Part C, 2006. [12] — — , “ Security policies for sharing knowledge in virtual communities,” IEEE Transactions on Systems, Man and Cybernetics - Part A, 2006. [13] M. Dahchour, A. Pirotte, and E. Zimanyi, “A generic role model for dynamic objects,” in Procs. of CAiSE’02, ser. LNCS, vol. 2348. Springer, 2002, pp. 643–658. [14] M. Dastani, V. Dignum, and F. Dignum, “ Role-assignment in open agent societies,” in Procs. of AAMAS’03. New York (NJ): ACM Press, 2003, pp. 489–496. [15] J. Ferber, O. Gutknecht, and F. Michel, “ From agents to organizations: an organizational view of multiagent systems,” in LNCS n. 2935: Procs. of AOSE’03. Springer Verlag, 2003, pp. 214–230. [16] J. Gibson, The Ecological Approach to Visual Perception. New Jersey: Lawrence Erlabum Associates, 1979. [17] N. Guarino and C. Welty, “ Evaluating ontological decisions with onto- clean,” Communications of ACM, vol. 45(2), pp. 61–65, 2002. [18] S. Herrmann, “ Object teams: Improving modularity for crosscutting collaborations,” in Procs. of Net.ObjectDays, 2002. [19] T. Juan and L. Sterling, “Achieving dynamic interfaces with agents concepts,” in Procs. of AAMAS’04, 2004. [20] C. Masolo, L. Vieu, E. Bottazzi, C. Catenacci, R. Ferrario, A. Gangemi, and N. Guarino, “ Social roles and their descriptions,” in Procs. of KR’04. AAAI Press, 2004, pp. 267–277. [21] M. Mezini and K. Ostermann, “ Conquering aspects with caesar,” in Procs. of the 2nd International Conference on Aspect-Oriented Software Development (AOSD). ACM Press, 2004, pp. 90–100. [22] M. Papazoglou and B. Kramer, “A database model for object dynamics,” The VLDB Journal, vol. 6(2), pp. 73–96, 1997. [23] N. Scharli, S. Ducasse, O. Nierstrasz, and A. Black, “ Traits: Composable units of behavior,” in LNCS, vol. 2743: Procs. of ECOOP’03, S. Verlag, Ed., Berlin, 2003, pp. 248–274. [24] F. Steimann, “ On the representation of roles in object-oriented and conceptual modelling,” Data and Knowledge Engineering, vol. 35, pp. 83–848, 2000. [25] The Object Management Group, “ Unified modeling language: Super- structure,” Available at: http://www.omg.org/. [26] M. Winikoff, “ JACK - intelligent agents: An industrial strength plat- form,” in Multi-Agent Programming, R. H. Bordini, M. Dastani, J. Dix, and A. El Fallah Seghrouchni, Eds. Berlin: Springer Verlag, 2005, pp. 175–193. [27] M. J. Wooldridge and N. R. Jennings, “ Intelligent agents: Theory and practice,” Knowledge Engineering Review, vol. 10, no. 2, pp. 115–152, 1995. [28] F. Zambonelli, N. Jennings, and M. Wooldridge, “ Developing multia- gent systems: The Gaia methodology,” IEEE Transactions of Software Engineering and Methodology, vol. 12(3), pp. 317–370, 2003. 165