Presentation is loading. Please wait.

Presentation is loading. Please wait.

Princess Nourah bint Abdulrahman University

Similar presentations


Presentation on theme: "Princess Nourah bint Abdulrahman University"— Presentation transcript:

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 Message type in a sequence diagram
Simple:This is a transfer of control from one object to another. Synchronous: If an object sends a synchronous message, it waits for an answer to that message before it proceeds with its business. Asynchronous: If an object sends an asynchronous message, it doesn't wait for an answer before it proceeds. Software Engineering Behavioral Diagrams

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 SSD for Process Sale scenario
Software Engineering Behavioral Diagrams

14 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

15 Example: use cases to SSD
Software Engineering Behavioral Diagrams

16 Request Appointment SD
Software Engineering Behavioral Diagrams

17 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

18 Collaboration Diagrams
Software Engineering Behavioral Diagrams

19 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

20 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

21 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

22 collaboration diagram notation
Software Engineering Behavioral Diagrams

23 Example: Collaboration Diagrams
Software Engineering Behavioral Diagrams

24 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

25 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

26 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

27 Statecharts Class diagrams describes static structure of a system.
Interaction diagrams describe the behaviour of a collaboration. How about describing the behaviour of a single object when it reacts to messages? Statecharts Statecharts describe all possible states that an object can get in to, and how the object responds to events. Software Engineering Behavioral Diagrams

28 Software Engineering Behavioral Diagrams

29 Software Engineering Behavioral Diagrams

30 Software Engineering Behavioral Diagrams

31 Statecharts A statechart diagram is a directed graph.The nodes of the graph represent states, and the arrows represent transitions between states caused by external events. Semantically this diagram says that if the current state of statechart machine M is STATE1, then when EVENT1 occurs, and if guard1 is true, then actions effect1 and effect2 will be performed and the current state will become STATE2. Upon entering STATE2, M will perform action1 and action2. While the current state is STATE2, M continually performs action3. Upon exiting STATE2, action4 will be performed Software Engineering Behavioral Diagrams

32 Example Software Engineering Behavioral Diagrams

33 Example Software Engineering Behavioral Diagrams

34 When to Use Statecharts
They are good at describing the behaviour of an object across several scenarios of use. They are not good at describing behaviour that involves a number of collaborating objects (use interaction diagrams for this). Not usually worthwhile to draw a statechart for every class in the system. Use them only for those classes that exhibit interesting behaviour. Software Engineering Behavioral Diagrams


Download ppt "Princess Nourah bint Abdulrahman University"

Similar presentations


Ads by Google