1 Sequence Diagrams (Based on Stevens and Pooley (2006, Chapters 9, 10) and Fowler (2004, Chapter 4)) David Meredith Aalborg University.

Slides:



Advertisements
Similar presentations
Object-Oriented Analysis and Design CHAPTERS 15: UML INTERACTION DIAGRAMS 1.
Advertisements

System Sequence Diagrams
Sequence Diagram Objects are represented horizontally across the top of the diagram Each object has a lifeline some exist before and/or after some are.
Interaction Diagrams - Chapter 15 Describe/illustrate sequence of message exchanges among objects that are working together to achieve some functionality.
Sept Ron McFadyen Interaction Diagrams - Chapter 15 Describe/illustrate sequence of message exchanges among objects that are working together.
Software Engineering COMP 201
Summary Class responsibility cards can be used to help allocate responsibilities between different classes. The use of stereotype classes, such as entity,
1 © Wolfgang Pelz UML2 UML Part Two. 2 © Wolfgang Pelz UML2 Chapters Four & Twelve Interaction Diagrams.
Sept Ron McFadyen Interaction Diagrams - Chapter 15 Describe/illustrate sequence of message exchanges among objects that are working together.
Essentials of interaction diagrams Lecture 23 & 24.
Essentials of interaction diagrams Lecture Outline Collaborations Interaction on collaboration diagrams Sequence diagrams Messages from an object.
03/12/2001 © Bennett, McRobb and Farmer Object Interaction Based on Chapter 9 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and.
Dynamic modeling using UML
Sequence Diagram. What is Sequence Diagram?  Sequence Diagram is a dynamic model of a use case, showing the interaction among classes during a specified.
SE-565 Software System Requirements More UML Diagrams.
SENG 403 SENG 403 – Winter  Brief introduction to SSD  Example (A sales systems (Cashier))  Example (Monopoly game) SENG 403 – Winter 2012.
SEQUENCE DIAGRAM Prepared by: T. Fatimah Alageel.
UML Sequence Diagrams Reading: UML Distilled Ch. 4, by M. Fowler
Karolina Muszyńska Based on: S. Wrycza, B. Marcinkowski, K. Wyrzykowski „Język UML 2.0 w modelowaniu SI”
UML for Java Programmers Object Mentor, Inc. Copyright  by Object Mentor, Inc All Rights Reserved
1 CIS224 Software Projects: Software Engineering and Research Methods Lecture 5a CRC Cards & Sequence Diagrams (Based on Stevens and Pooley (2006, Section.
Sequence Diagram Tutorial
CS3773 Software Engineering
UML Collaboration Diagram. Recap System Sequence Diagrams (SSD) UML for SSD Examples.
Interaction diagrams Sequence and collaboration diagrams.
Introduction to Interaction Diagrams Used to illustrate the dynamic behaviour of a community of objects that collaborate by passing messages in order to.
UML S EQUENCE D IAGRAMS 1 Dr. Hoang Huu Hanh, OST – Hue University hanh-at-hueuni.edu.vn.
System Sequence Diagrams. Recap When to create SSD? How to identify classes/instances? Use case descriptions UML notations for SSD.
Chapter 5 – System Modeling
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 9: Interaction.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 UML Sequence Diagrams.
UML January 26, 2011 CSE 403, Winter 2011, Brun UML Sequence Diagrams.
Collaboration Diagrams CSIS3600. What is a Collaboration Diagram Collaboration diagrams illustrate interactions between objects The collaboration diagram.
1 UML Sequence Diagrams UML Distilled, Third Edition, Chapter 4 M. Fowler.
Smith’s Aerospace © P. Bailey & K. Vander Linden, 2005 Interaction and Communication Diagrams Patrick Bailey Keith Vander Linden Calvin College.
Discovering object interaction. Use case realisation The USE CASE diagram presents an outside view of the system. The functionality of the use case is.
 C-style pointer-based arrays  Have great potential for errors and several shortcomings  C++ does not check whether subscripts fall outside the range.
Information Systems Engineering Interaction Diagrams: Sequence Diagram Collbortion Diagram.
Interaction Diagrams Interaction Diagrams allow the designer to show how groups of objects collaborate in some behavior. –Interaction Diagrams will show.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 8: Modelling Interactions and Behaviour UML Sequence Diagram.
Sequence Diagrams CSIS3600. Sequence Diagrams A sequence diagram shows an interaction arranged in time sequence. In particular, it shows the objects participating.
Object Oriented Analysis and Design Sequence Diagrams.
Karolina Muszyńska Based on: S. Wrycza, B. Marcinkowski, K. Wyrzykowski „Język UML 2.0 w modelowaniu SI”
Chapter 3: Introducing the UML
Sequence Diagram SAD ::: Fall 2015 Sabbir Muhammad Saleh.
CSE 403 Lecture 8 UML Sequence Diagrams Reading: UML Distilled, Ch. 4, M. Fowler slides created by Marty Stepp
 The Sequence Diagram models the collaboration of objects based on a time sequence.  It shows how the objects interact with others in a particular scenario.
Project 2: Phase 1 Submission 7 Late submissions 10% 10 No submissions 14% Better than project 1 phase 3 submissions 10-point bonus: If you catch the deadline.
Sequence Diagram Lecture # 1. Sequence Diagram Definition A Sequence diagram is an interaction diagram that shows how the objects and classes involved.
Sequence Diagram.
UML SEQUENCE DIAGRAM.
Chapter 11: Collaboration Diagram - PART1
UML UML Sequence Diagrams CSE 403
Sequence Diagram.
Prepared By Sidra Noureen
Sequence Diagram.
Sequence Diagrams.
Princess Nourah bint Abdulrahman University
UML Sequence Diagrams.
Object Oriented Analysis and Design
Princess Nourah bint Abdulrahman University
IMAT5205 Systems Analysis and Design
Superior University, Lahore
Interaction diagrams.
Sequence Diagrams Getting the Message.
Unified Modelling Language
Chapter 9: Sequence Diagrams Chapter 5 in Software Engineering Book
Interaction diagrams Interaction diagrams are models that describe how groups of objects collaborate in some behavior. Typically, an interaction diagram.
UML Interaction diagrams
Chapter 9: Sequence Diagrams Chapter 5 in Software Engineering Book
Presentation transcript:

1 Sequence Diagrams (Based on Stevens and Pooley (2006, Chapters 9, 10) and Fowler (2004, Chapter 4)) David Meredith Aalborg University

2 Interaction diagrams Use case diagram describes tasks that system must help actors to perform Class diagram describes classes required to realize use cases and relationships between these classes Interaction diagrams describe how objects interact to realize the use case scenarios

3 Sequence diagrams Sequence diagram shows how actors and objects interact to realize a use case scenario Only shows actors and objects involved in the scenario Each object or actor is called a participant and is represented by an icon in a row across the top of the diagram Extending down the page from each participant is a dashed line called a lifeline Time is understood to move forward as we move down the diagram A message sent from participant A to participant B is represented by an arrow with a solid line drawn from the lifeline of A to the lifeline of B (sync msg 2) If A has to stop computing while B carries out the operation invoked by the message sent to it by A, then this message is said to be synchronous and control is passed from A to B A synchronous message is represented on a sequence diagram by an arrow with a solid black triangular head

Sequence diagrams When B receives the message, it starts to have a new live activation, denoted here by V This activation is represented by drawing a narrow rectangle covering the lifeline of B, starting at the point where the arrow representing the message from A hits the lifeline of B In a procedural interaction (no concurrency), exactly one object is computing at any given instant If B sends a message to another object, C, B may stop computing temporarily while C starts to have a new live activation, X B will continue to have the live activation, V, until it has finished carrying out the operation invoked by the message, sync msg 2, sent to it by A At the end of its activation, B might send a return value to A, indicated by the dashed arrow with the stick head shown 4

5 Sequence diagrams Can indicate when an object is computing by shading those periods on the activations For readability, the participants should generally be arranged in the order in which they first participate in the interaction This means that most of the message sends are represented by arrows that go from left to right If an object of class A sends a message to an object of class B in a sequence diagram, this implies that there is an association between class A and class B in the class model In procedural systems, only actors can initiate activity by sending a message "out of the blue" System objects can only send messages when they have been made active by receiving a message from another object

Sequence diagrams At any given instant there will be a stack of live activations and the one at the top of the stack will be the one that currently has control and is computing All the other activated objects are waiting to receive control back from objects to which they have sent messages If the object whose activation is currently at the top of the stack (e.g., B) sends a message, then the object that receives this message (C) becomes active and its activation (X) becomes the top of the stack If the activation X of the object, C, is at the top of the stack and it terminates, then its activation is removed from the stack and control returns to the object B whose message send, sync msg 3, started the activation X The activation V during which sync msg 3 was sent then becomes the new top of the stack 6

7 Sequence diagrams If an object sends a message to itself, then the object gets another new live activation That is, the object now has two live activations on the stack Represented on sequence diagram by a nested activation, with activation resulting from message to self slightly offset from older activation

More advanced features Diagram describes process of promoting me to be Head of Department within personnel department database No need to name participant objects and actors –Can just precede class of object with a colon to indicate that participant is an object, not a class Reply message arrow can be labelled with assignment of return value to a variable –Actual value returned can be given after colon Object disposal or destruction indicated by a synchronous message sent to the object whose lifeline is terminated with an X Construction of new object indicated by horizontal asynchronous message arrow directly to the head of the new participant –Asynchronous message arrow has stick head Synchronous message arrow has solid black triangular head –Asynchronous message starts a new thread of control Participant that sends asynchronous message continues computing after sending message

9 Conditional behaviour Different scenarios within a use case can sometimes be represented on same sequence diagram by guarding parts of the interaction with conditions Conditional behaviour enclosed within rectangle labelled “opt” (for “optional”) Guard condition written between square brackets near “opt” label

10 Conditional behaviour and loops loop and alt frames

11 Concurrency and asynchronous calls In single-threaded, procedural interaction, only one participant computing at any given time and all messages are synchronous –When object sends synchronous message, stops computing and loses control until receiver finishes handling message and returns –Return may be indicated on diagram In multi-threaded, concurrent interaction, two or more objects computing simultaneously –Some messages may be asynchronous When object sends asynchronous message, can continue computing and recipient also gets a live activation – generates two concurrent threads

12 Summary Interaction diagrams describe how objects interact to realize use cases Sequence diagrams –participants, lifelines, activations, messages, returns –synchronous and asynchronous messages –messages to self –representing creation and destruction of objects –representing return values –representing conditionals and loops –asynchronous calls and concurrency