Composite Structure Diagram Luca Colombi Abstract UML 2.0 composite structure diagram Basic concepts Structure, structured entity, internal structure Elements Property Connector Nested notation Description power Classes & Structured Classes Instance specification Namespace behaviour Collaboration Purpose Roles Role binder Collaboration Occurrence Occurrence binder <<occurrence>> & <<represent>> Port Visibility Interfaces Examples UML 2.0 diagram Classified in UML 2.0 structural diagrams New: this diagram was not available in UML 1.* Purpose Composite structure diagrams can be used to describe: structures of interconnected parts run-time structures of interconnected instances Example: Description of the parts of an engine that are interconnected to perform the engine functioning Structure A set of instances that communicate and collaborate at run-time to realize a common goal Ex.: net routers that realize a particular journey Structured element: An element realized by a structure Ex.: a net realized by routers Internal structure: A structure that realize a structured element Ex.: all the routers in a net Property A set of instances contained in a structured instance MailSender role of the property instances for the container (optional) type or class of the property instances (obligatory) ms:MailSender roleName:TypeName ms:MailSender sendMail(…) Connector Represents the visibility between two property a communication way proprerty w:Well role multeplicity (optional) connector type (optional) 2 a:Axis [Multeplicity1] [multeplicity2] roleName1 connName:ConnType connector name (optional) 1 roleName2 e:Engine role name (optional) Nested notation Composite structure diagrams allows to use class diagram-like or nested notation It is permitted to recursively nest already nested entities Container Container contained1:Inner1[n1] contained2:Inner2[n2] contained1:Inner1 property contained3:Inner3 contained2:Inner2 contained3:Inner3 inner dash if not a composition multeplicity (integer, optional) Structured Class: example Recursive application of nested notation can be done inside a single diagram RoomContents john:Man geranium:Plant height:real Leaf[*] Trunk Description power Nested notation can describe all things describable in 1.* class diagrams notation, and a little more Car Car w 2 Wheel 1 e Engine * * Axis w:Wheel[4] 2 1 e:Engine a:Axis Instance specification describes the property which is returned by an operation call, the operation is pointed by the arrow at the end of a dashed line that starts from the returned type description <<create>> is an optional label and specify that label exists only after the operation call Room createChair(…) getWindow(…) <<create>> w:Window c:Chair Leg[4] Namespace behaviour A structured class acts as a namespace for its internal descriptions, so descriptions are not implicitly exported Collaboration A joining of structure elements that collaborate to collectively perform a task The name given to the collaboration (obligatory) Used in nested notation CollaborationName CollaborationName Collaboration purpose A collaboration wants to describe a structure behaviour made by structure property Must be connected only with property which are required to perform its described behaviour Collaboration role property which collaborate to perform the collaboration goal, interpreting roles Each collaboration role perform a specific task “Counting of clients” have some ClientCard as roles Counting of clients ClientCard name:String address:String … Collaboration Role Binder represent a participation of the role to the collaboration property the name given to the role Pilot collaboration Drive a car roleName Car Collaboration Occurrence A specific collaboration instance occName:CollName used in nested notation name of the instance (obligatory) type of the instance (obligatory) occName:CollName send:MailSend Occurrence binder Binds an occurrence to a role, maybe specifing how many occurrence repetitions are present occName:CollName roleName[n] role name (optional) RoleType role multeplicity (optional) roleName:RoleType [n] selled[12] occName:CollName Egg sellProduct:Sell john:Countryman Example: occurrence - Send mail [1] mailServer[2] [1] Receiver Sender send:Send an email <<occurrence>> label A dashed arrow between two symbol of same type means that pointing symbol represent pointed symbol, like in a specialization <<occurrence>> label is optional Building Communicate <<occurrence>> <<occurrence>> Home Send email <<represent>> label A dashed arrow from a collaboration or an occurrence to a property means that property use the other instance, like a client or a use case primary actor <<represent>> label is optional client:CurrentAccount accredit(…) <<represent>> deposit:Increase amount Occurrence binding nest crossing Occurrence binding is admitted between separately nested elements with also have occurrence bindings products transport p:producer putting on shelf d:dealer Port represent a property communication point, and is always placed where the property joins whit its connector two types of communications: Between a property and its external environment Between a property and its internal structure Ports: visibility marking If port symbol cover a rectangle boundary his visibility is public If port symbol is placed inside a rectangle, adjacent to his boundary, his visibility is protected port instance name (optional) port type (optional) Computer portName:EntityName[n] m:Monitor[1] property port multeplicity (optional) User portName:EntityName[n] Ports: interfaces An interface exported by a port is a little circle (interface symbol) connected with the port symbol by a line An interface needed by a port is a little semicircle (socket symbol) connected with the port symbol by a line If interface is present, interface type is signed near interface symbol Ports: interfaces examples Apache httpService:HttpSrvc [100] sqlServer:SqlSrv [1] Apache httpService:HttpSrvc [100] SqlSrv sqlServer[1] HttpSrvc Apache httpService [100] SqlSrv sqlServer Example: Port Structure with many kinds of connectors and ports: StudentRoom Keyboard :Key[101] p:RoomDoor Student Computer w:Window Monitor Example: structured class House House :Window :Window Kitchen Bath :Window :Door Passage :Window[2] Hall [1] Bedroom[2] [1] :Window[1] Example: collaboration - Drive a taxi Drive a taxy Car GE_553912:Taxy Well[4] :SteeringWheel [2] Engine [1] place:Seat [0..5] Body john:TaxyDriver Head kate:Passenger Leg[2] [2] Bust [2] Arm[2] References OMG official site for UML: http://www.uml.org Agile software association Composite structure diagrams: http://www.agilemodeling.com/artifacts/compositeStructureDiagram.htm