The semantics of the UML Collaboration Trygve.Reenskaug@ifi.uio.no http://www.ifi.uio.no/~trygver 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
Legal Notice This presentation is copyright ©1999 Trygve Reenskaug, Lasse Bjerde Oslo, Norway. All rights reserved. Unauthorized reproduction prohibited. 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
Summary Collaborations model run-time system Collaborations model open systems ClassifierRole defined in terms of Collaboration instance Separation of concern: Horizontal: Subsystem object grouping Vertical: Collaboration on behavior VirtualRole: package of ClassifierRole Virtual Interaction: Comment Collaboration specifies system behavior Proposed metamodel extension 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
A system is a chosen perspective on reality A system is a part of the real world which we choose to regard as a whole, separated from the rest of the world during some period of consideration. A whole that we choose to consider as a collection of parts, each part being characterized by attributes and by actions which may involve itself and other parts. Holbæk_Hanssen et.al.: System Description and the Delta Language Oslo, 1977 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
Consider the Universe as a Universe of objects 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
The object paradigm is very simple UML Class Abstraction cannot model message sends. Use UML Collaboration abstraction for system modeling Object-B IN OUT-B OUT-C Methods Variables IN OUT-C Object-C Methods Variables Object Orientation Encapsulation: Package data with methods; Collaborators only see object’s interfaces Object identity supports Distributed logic: everything happens within some object, nothing outside the objects Role models describe system behavior as object collaboration Role model synthesis: Inherit collaboration with roles and system behavior Essentially black box - implementation hidden/postponed Object-A IN Methods Variables Message (operation) triggers method causes response 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
Summary Collaborations model open systems Collaborations model run-time system Collaborations model open systems ClassifierRole defined in terms of Collaboration instance Separation of concern: Horizontal: Subsystem object grouping Vertical: Collaboration on behavior VirtualRole: package of ClassifierRole Virtual Interaction: Comment Collaboration specifies system behavior Proposed metamodel extension 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
An Open System For a given system, the environment is the set of all objects outside the system whose actions affect it or who are affected by the system, and also those objects outside the system whose attributes are changed by its actions. Etzioni: Modern Organizations Prentice-Hall, 1964 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
Open systems interact with environment objects 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
The collaboration is a topological model of a system of objects 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
Typing AssociationEndRoles / Father / Mother Mother_Child_Intf cashRequested() Child_Mother_Intf cashReceived() / Child 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
Summary ClassifierRole defined in terms of Collaboration instance Collaborations model run-time system Collaborations model open systems ClassifierRole defined in terms of Collaboration instance Separation of concern: Horizontal: Subsystem object grouping Vertical: Collaboration on behavior VirtualRole: package of ClassifierRole Virtual Interaction: Comment Collaboration specifies system behavior Proposed metamodel extension 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
Collaboration (definition) A Collaboration describes how a number of objects work together for a common purpose. The structural aspect is a description of the responsibilities of each object in the context of the overall purpose of the collaboration; and also the links that connect the objects into a communicating whole. The dynamic aspect is a description of how stimuli flow between the objects to achieve the common purpose. 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
ClassifierRole (definition) A classifierRole is a named slot for an object participating in a Collaboration. Object behavior is represented by its participation in the overall behavior of the Collaboration. Object identity is preserved through this constraint: "In an instance of a collaboration, each ClassifierRole maps onto at most one object." 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
Summary Separation of concern: Horizontal: Subsystem object grouping Collaborations model run-time system Collaborations model open systems ClassifierRole defined in terms of Collaboration instance Separation of concern: Horizontal: Subsystem object grouping Vertical: Collaboration on behavior VirtualRole: package of ClassifierRole Virtual Interaction: Comment Collaboration specifies system behavior Proposed metamodel extension 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
Separation of concern Cluster objects into “super-objects” The (EJB) Component: A Component has a single access point (an object ID) and offers a well-defined interface to its clients. A Component is reused by cloning A Component does not make assumptions about its clients A Component plays a standardized role within a container Tools are used to deploy components and compose systems 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
Horizontal Separation of Concern Object clustering «EJB» BeanExample UML 1.3 Subsystem 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
Vertical Separation of Concern Collaborations separate on behavior Collaboration for Use case / operation UC1 Collaboration for Use case / operation UC2 Object Object Object Object A B C D 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
Summary VirtualRole: package of ClassifierRole Collaborations model run-time system Collaborations model open systems ClassifierRole defined in terms of Collaboration instance Separation of concern: Horizontal: Subsystem object grouping Vertical: Collaboration on behavior VirtualRole: package of ClassifierRole Virtual Interaction: Comment Collaboration specifies system behavior Proposed metamodel extension 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
Virtual Roles Example Activity Network Activity-B Activity-D 8 (4) 12 13 (3) 16 Activity-A Activity-F 5 (3) 8 20 (4) 24 Activity-C Activity-E 8 (5) 13 13 (7) 20 Completion time Duration Start time 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
Virtual Roles Four designs /ViewPackage «virtualRole» /ViewPackage / NetworkView / NetworkModel * 1 / ActivityView 1 * / ActivityModel 1 * * 1 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
VirtualRoles Use Case system Function Traveler Paymaster 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
Summary Virtual Interaction: Comment Collaborations model run-time system Collaborations model open systems ClassifierRole defined in terms of Collaboration instance Separation of concern: Horizontal: Subsystem object grouping Vertical: Collaboration on behavior VirtualRole: package of ClassifierRole Virtual Interaction: Comment Collaboration specifies system behavior Proposed metamodel extension 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
Virtual Interactions - transfer information to view - alert view of changes in model «virtualRole» «virtualRole» / View / Model 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
Summary Collaboration specifies system behavior Collaborations model run-time system Collaborations model open systems ClassifierRole defined in terms of Collaboration instance Separation of concern: Horizontal: Subsystem object grouping Vertical: Collaboration on behavior VirtualRole: package of ClassifierRole Virtual Interaction: Comment Collaboration specifies system behavior Proposed metamodel extension 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
Role and system behavior The Collaboration / File start() 1 read() write() stop() 1 / Master 1 fileStarted() runCompleted() fileStopped() 1 * / Slave * run() 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
Role and system behavior Message Sequence /Master /File /Slave start() fileStarted() run() read() readDone() write() writeDone() runCompleted() stop() fileStopped() 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
Role and system behavior Role State Machines Slave.readDone(); Idle start/ open file; master.fileStarted(); Ready stop /closeFile; Master.fileStopped(); / File Done Initial read /read(); write /write(); Slave.writeDone(); Stopping WaitComplete WaitStart / Master Initial/File.start(); fileStarted /Slave.run(); runCompleted /File.stop(); fileStopped final Idle done Editing run/File.read(); writeDone /Master.runCompleted(); readDone /File.write(); / Slave Initial 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
Role and system behavior System State Machine Initial->File.start(); Master-WaitStart & File-Idle & Slave-Idle File start / open file; Master.fileStarted; Master-WaitStart & File-Ready & Slave-Idle Master fileStarted / Slave.run(); Master-WaitComplete & File-Ready & Slave-Idle Slave run / File.read() Master-WaitComplete & File-Ready & Slave-Editing 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
Summary Proposed metamodel extension Collaborations model run-time system Collaborations model open systems ClassifierRole defined in terms of Collaboration instance Separation of concern: Horizontal: Subsystem object grouping Vertical: Collaboration on behavior VirtualRole: package of ClassifierRole Virtual Interaction: Comment Collaboration specifies system behavior Proposed metamodel extension 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
Metamodel extension for Instance Level Collaboration classifier GeneralizableElement Namespace Classifier (from Core) 1..* (from Core) (from Core) 1..* base * ClassifierRole SpecificationCollaboration 1 ownedElement (from Collaborations) (from Collaborations) 1..* multiplicity: Multiplicity 1 ModelElement (from Core) * * 1..* Instance * InstanceCollaboration (from Common Behavior) instance (new) roleInstance 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
Metamodel extension for OCL Definition of Collaboration context InstanceCollaboration inv: self.specificationCollaboration.ownedElement-> forAll( c : ClassifierRole | c.instance->select(i : Instance | self.roleInstance->includes(i))->size <= 1) My thanks to Jos Warmer 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration
THANK YOU 1/15/2019 Trygve Reenskaug: Semantics of UML Collaboration