Download presentation
Presentation is loading. Please wait.
1
Princess Nourah bint Abdulrahman University
System Sequence Diagrams Collaboration Diagrams Chapter 7 Behavioral Diagrams: Princess Nourah bint Abdulrahman University College of Computer and Information Sciences Department of Computer Science Dr. Doaa Sami Khafaga
2
Objectives Describe the evolutionary approach for using sequence diagrams to complete class diagrams Introduce the syntax of sequence diagrams Explain how message are interleaved between objects to build sequence diagrams Software Engineering Behavioral Diagrams
3
Object behaviour modelling
Interaction diagrams model how groups of object collaborate to perform some behavior Typically captures the behavior of a single use case Software Engineering Behavioral Diagrams
4
System Sequence Diagrams
Software Engineering Behavioral Diagrams
5
System Sequence Diagrams
A system sequence diagram illustrates events from actors to systems and the external response of the system. This activity occurs during the analysis phase of a development cycle; dependent on the creation of the use cases and identification of concepts. One diagram depicts one scenario.This is the main success scenario. Frequent or complex alternate scenarios could also be illustrated. A system is treated as a black box. SSD is often accompanied by a textual description of the scenario to the left of the diagram. Software Engineering Behavioral Diagrams
6
System sequence Diagrams
Software Engineering Behavioral Diagrams
7
System Sequence Diagram (SSD) for a Use Case (UC)
Software Engineering Behavioral Diagrams
8
Messages message sent from one object to another (method
42 An interaction between two objects is performed as a message sent from one object to another (method call, signal, ). A message is labeled with the message name. There are two kinds of messages: Synchronous: the caller/sender waits for return/replay (e.g. method call). Asynchronous: the sender proceeds without waiting for a replay (e.g. ). The following means either of the above: Return value optionally indicated using a dashed arrow with a label indicating the return value.
9
Sequence Diagrams (SD)
Software Engineering Behavioral Diagrams
10
Sequence Diagrams (SD)
Software Engineering Behavioral Diagrams
11
Sequence Diagram Syntax
Software Engineering Behavioral Diagrams
12
Example of Sequence Diagram
Software Engineering Behavioral Diagrams
13
Conditional Interaction
44 A message can include a guard, which signifies that the message is only sent if a certain condition is met. The guard is simply that condition between brackets
14
Conditional Interaction Cont.
45 If you want to show that several messages are conditionally sent under the same guard, you'll have to use an 'opt' combined fragment. The combined fragment is shown as a large rectangle with an 'opt' operator plus a guard, and contains all the conditional messages under that guard.
15
Repeated Interaction '*'symbol), it means that the message is sent
46 When a message is prefixed with an asterisk (the '*'symbol), it means that the message is sent repeatedly. A guard indicates the condition that determines whether or not the message should be sent (again). As long as the condition holds, the message is repeated
16
Repeated Interaction Cont.
47 If you want to show that multiple messages are sent in the same iteration, a 'loop' combined fragment can be used. The operator of the combined fragment is 'loop' and the guard represents the condition to control the repetition.
17
From Use Case to Sequence System Diagram
How to construct an SSD from a use case: Draw System as black box on right side For each actor that directly operates on the System, draw a stick figure and a lifeline. For each System events that each actor generates in use case, draw a message. Optionally, include use case text to left of diagram. Software Engineering Behavioral Diagrams
18
Example: use cases to SSD
Software Engineering Behavioral Diagrams
19
Request Appointment SD
Software Engineering Behavioral Diagrams
20
Collaboration Diagrams
Semantically equivalent to sequence diagrams. Objects are shown as icons, and can be placed anywhere on the page/screen. Sequence of message firings is shown by numbering the messages. Easier to depict object links and layout with collaboration diagrams; they’re also more compact. Easier to see sequence with sequence diagrams. Software Engineering Behavioral Diagrams
21
Collaboration Diagrams
Software Engineering Behavioral Diagrams
22
Collaboration Diagrams
A collaboration diagram describes a pattern of interaction among objects. Client Object Link Supplier Object It shows objects participating in the interaction by their links to each other and the :Client messages that they send to each other. :Supplier An object is represented in three ways: Objectname:Classname, Objectname, 1: PerformResponsibility and :Classname Message A link is a relationship among objects across which messages can be sent. In a collaboration diagram, a link is shown as a solid line between two objects. A link can be an instance of an association, or it can be anonymous – meaning that its association is unspecified. Software Engineering Behavioral Diagrams
23
Collaboration Diagrams
A message is a communication between objects that conveys information with the expectation that activity will ensue. In collaboration diagrams, a message is shown as a labeled arrow placed near a link. This means that the link is used to transport, or otherwise implement the delivery of the message to the target object. The arrow points along the link in the direction of the target object (the one that receives the message). The arrow is labeled with the name of the message, and its parameters. Software Engineering Behavioral Diagrams
24
Collaboration Diagrams
The arrow may also be labeled with a sequence number to show the sequence of the message in the overall interaction. Sequence numbers are often used in collaboration diagrams, because they are the only way of describing the relative sequencing of messages. (A message can be unassigned, meaning that its name is a temporary string that describes the overall meaning of the message, like //get_schedule(). You can later assign the message by specifying the operation of the message's destination object. The specified operation will then replace the name of the message. Frequently locked in upon further analysis Software Engineering Behavioral Diagrams
25
collaboration diagram notation
Software Engineering Behavioral Diagrams
26
Example: Collaboration Diagrams
Software Engineering Behavioral Diagrams
27
Example: Collaboration Diagrams
This example shows the collaboration of objects to support the Request Appointment use case: Create a Schedule subflow. It is the “collaboration diagram equivalent” of the sequence diagram shown earlier. Software Engineering Behavioral Diagrams
28
Collaboration Diagrams Vs Sequence Diagrams
Same information expressed in different ways… Collaboration Diagrams Show relationships in addition to interactions Better for visualizing patterns of collaboration Better for visualizing all of the effects on a given object Easier to use for brainstorming sessions Sequence Diagrams Show the explicit sequence of messages Better for visualizing overall flow Better for real-time specifications and for complex scenarios Software Engineering Behavioral Diagrams
29
Collaboration Diagrams Vs Object Diagrams
A collaboration diagram without messages is also known as an object diagram. The relationships between objects are called links. An object diagram must be a valid instantiation of a static class diagram. Objects must have classes. Links between objects must be instances of associations between classes. Use this as a quick consistency check. Software Engineering Behavioral Diagrams
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.