Presentation is loading. Please wait.

Presentation is loading. Please wait.

Www.ddss.arch.tue.nl 7M822 UML Interaction Diagrams 25 November 2010.

Similar presentations


Presentation on theme: "Www.ddss.arch.tue.nl 7M822 UML Interaction Diagrams 25 November 2010."— Presentation transcript:

1 www.ddss.arch.tue.nl 7M822 UML Interaction Diagrams 25 November 2010

2 www.ddss.arch.tue.nl 7M822 UML Views Logical view Concurrency view Component view Deployment view Use Case view 2

3 www.ddss.arch.tue.nl 7M822 Behaviour modelling Behaviour models are used to describe the overall behaviour of the system. Objects interact to implement behaviour. This interaction can be described in two complementary ways, one of them is centred on individual objects and the other on a collection of cooperating objects. 3

4 www.ddss.arch.tue.nl 7M822 UML Diagrams Structure diagram –Class diagram –Object diagram –Component diagram –Deployment diagram –Package diagram Behaviour diagram –Use Case diagram –Activity diagram –Interaction diagram Sequence diagram Communication diagram 4

5 www.ddss.arch.tue.nl 7M822 UML Diagrams Structure diagram –Class diagram –Object diagram –Component diagram –Deployment diagram –Package diagram Behaviour diagram –Use Case diagram –Activity diagram –Interaction diagram Sequence diagram Communication diagram 5

6 www.ddss.arch.tue.nl 7M822 Interactions 1 of 2 An interaction is a behavior that comprises a set of messages exchanging among a set of objects with a context to accomplish a purpose. Interactions are used to model the dynamic aspect of collaborations, representing societies of objects playing specific roles, all working together to carry out some behavior that’s bigger than the sum of the elements. 6

7 www.ddss.arch.tue.nl 7M822 Interactions 2 of 2 Roles, links, messages, actions, and sequences Modeling flows of control Each interaction can be modeled in two ways: –by emphasizing its time ordering of messages, or –by emphasizing its sequencing of messages in the context of some structural organization of objects. 7

8 www.ddss.arch.tue.nl 7M822 In a nutshell: what are interactions? A collection of communications between instances, including all ways to affect instances, like operation invocation, as well as creation and destruction of instances The communications are partially ordered (in time) 8

9 www.ddss.arch.tue.nl 7M822 Interaction Diagram Guide Show interactions between instances in the model –graph of instances (possibly including links) and stimuli –existing instances –creation and deletion of instances Kinds –Sequence diagram (temporal focus)  –Communication diagram (structural focus) 9

10 www.ddss.arch.tue.nl 7M822 Interaction Diagrams 10 xyz Sequence Diagram a b c Communication Diagram xy z 1.1: a 1.2: c 1.1.1: b

11 www.ddss.arch.tue.nl 7M822 Sequence Diagram 11

12 www.ddss.arch.tue.nl 7M822 Different Kinds of Arrows 12

13 www.ddss.arch.tue.nl 7M822 Lifeline & Messages The vertical line is called the object’s lifeline. The lifeline represents the object’s life during the interaction. Each message is represented by an arrow between the lifelines of two objects. The order in which these messages occur is shown top to bottom. Each message is labeled at minimum with the message name; also arguments and some control information can be included. A self-back is a message that an object sends to itself, by sending the message arrow back to the same lifeline. 13

14 www.ddss.arch.tue.nl 7M822 Communication Diagram 14

15 www.ddss.arch.tue.nl 7M822 Sequence Diagram / Communication Diagram 15

16 www.ddss.arch.tue.nl 7M822 Sequence Diagram vs. Communication Diagram Sequence diagrams are used when you want to look at the behavior of several objects within a single use case. Sequence diagrams are good at showing collaborations among the objects. Communication diagrams emphasize the data links between the various participants in the interaction. With communication diagrams we can show how the participants are linked together. 16

17 www.ddss.arch.tue.nl 7M822 Elements Sequence Diagrams 17

18 www.ddss.arch.tue.nl 7M822 Next Concepts Sequence Diagrams 1of2 18 control guard

19 www.ddss.arch.tue.nl 7M822 Next Concepts Sequence Diagrams 2of2 19 { a b-a < 5 sec b b'-b < 1 sec b' } constraint

20 www.ddss.arch.tue.nl 7M822 Sequence Diagram – an Example A sequence diagram captures the behaviour of a scenario. The diagram shows a number of objects and the messages that are passed between these objects within the use case. A sequence diagram shows a set of messages arranged in time sequence. 20

21 www.ddss.arch.tue.nl 7M822 NS Ticket service Take ticket Destination 21

22 www.ddss.arch.tue.nl 7M822 Class diagram of ‘NS ticket service’ including the classes ‘Ticket’ and ‘Destination’ 22

23 www.ddss.arch.tue.nl 7M822 NS Ticket machine – use case text Use Case Buy OV Ticket Actors Traveller Preconditions Traveller has a valid pass Description 1.Ticket device expects destination code 2.Traveller enters destination code 3.Extension point: NS ticket 4.Ticket device checks code and calculates the charge. Shows destination code & fare. Activates ticket machine for paying 5.Traveller pays (use case: Pay ticket) 6.Ticket device print and supplies ticket 7.Traveller takes ticket Extension Destination code = NS station. 3a. Ticket device expects ticket type 3b. Traveller enters Single/Return, Discount Y/N, Class Exceptions Traveller interrupt the interaction or walk away Traveller enters an incorrect destination code Payment is not finished off successful Result Traveller has ticket. (NS can look forward to the payment) 23

24 www.ddss.arch.tue.nl 7M822 Sequence diagram – Buy ticket 24

25 www.ddss.arch.tue.nl 7M822 Elevator Example Scenario User pressed floor button Elevator system detects floor button pressed Elevator moves to floor Elevator open doors User gets in and press elevator button Elevator moves to required floor Elevator open doors User gets out Elevator close doors 25


Download ppt "Www.ddss.arch.tue.nl 7M822 UML Interaction Diagrams 25 November 2010."

Similar presentations


Ads by Google