Sequence Diagrams. Massimo Felici. Massimo Felici Sequence Diagrams c 2004 2011



Similar documents
Communication Diagrams

Using UML Part Two Behavioral Modeling Diagrams

Introduction. UML = Unified Modeling Language It is a standardized visual modeling language.

Sequence Diagram Tutorial. From: UML Distilled, Third Edition, Chapter 4 M. Fowler

Interaction Diagrams. Use Cases and Actors INTERACTION MODELING

Process Modeling Notations and Workflow Patterns

[1] [2]

Aspect Oriented Strategy to model the Examination Management Systems

A UML Introduction Tutorial

Announcements. SE 1: Software Requirements Specification and Analysis. Review: Use Case Descriptions

Applying 4+1 View Architecture with UML 2. White Paper

Object Oriented Programming. Risk Management

Architecture Design & Sequence Diagram. Week 7

Object Oriented Design

Case studies: Outline. Requirement Engineering. Case Study: Automated Banking System. UML and Case Studies ITNP090 - Object Oriented Software Design

Tutorial - Building a Use Case Diagram

Structure of Presentation. The Role of Programming in Informatics Curricula. Concepts of Informatics 2. Concepts of Informatics 1

UML Tutorial: Sequence Diagrams.

Use Cases. Massimo Felici. Massimo Felici Use Cases c

CPS122 Lecture: State and Activity Diagrams in UML

Design and UML Class Diagrams. Suggested reading: Practical UML: A hands on introduction for developers

Communications Software Engineering Design Model

Chapter 19. Activity Diagrams

Compliance and Requirement Traceability for SysML v.1.0a

Algorithm & Flowchart & Pseudo code. Staff Incharge: S.Sasirekha

Real Time Programming: Concepts

UML basics. Part II: The activity diagram. The activity diagram's purpose. by Donald Bell IBM Global Services

Business-Driven Software Engineering Lecture 3 Foundations of Processes

Human-Readable BPMN Diagrams

Requirements engineering

Appendix... B. The Object Constraint

PHP Code Design. The data structure of a relational database can be represented with a Data Model diagram, also called an Entity-Relation diagram.

Software Architecture Document

The Business Process Model

How To Develop Software

Modeling Guidelines Manual

Numeracy and mathematics Experiences and outcomes

System Modeling / Class Diagra Diagr m a Week 6

Chapter 4 Software Lifecycle and Performance Analysis

Fundamentals of Java Programming

SOFT 437. Software Performance Analysis. Ch 5:Web Applications and Other Distributed Systems

Table of Contents. Preface. Chapter 1 Introduction 1.1 Background. 1.2 Problem description. 1.3 The role of standardization. 1.4 Scope and objectives

: provid.ir

Chap 1. Introduction to Software Architecture

i. Node Y Represented by a block or part. SysML::Block,

Model Simulation in Rational Software Architect: Business Process Simulation

TDDC88 Lab 2 Unified Modeling Language (UML)

International Journal of Software Engineering and Knowledge Engineering Vol. 11, No. 3 (2001) World Scientific Publishing Company

INTERNATIONAL TELECOMMUNICATION UNION

Business Process Modelling. CA4 Business Process Modelling 1

Software Engineering. System Models. Based on Software Engineering, 7 th Edition by Ian Sommerville

Software Engineering. System Modeling

BPMN 2.0 Descriptive Constructs

Developing Conceptual Understanding of Number. Set J: Perimeter and Area

StarUML Documentation

LECTURE 11: PROCESS MODELING

Graphical Project Planning Techniques: An Overview of Gantt, PERT, and CPM Charts Prepared for groups in ECE480 1/6/02, D. Grover

BCS Certificate in Systems Modelling Techniques Syllabus

Introduction to BPMN

Quick Guide Business Process Modeling Notation (BPMN)

Fundamentals of Visual Modeling

In this Lecture you will Learn: Systems Development Methodologies. Why Methodology? Why Methodology?

Process Modeling using BPMN 2.0

In mathematics, there are four attainment targets: using and applying mathematics; number and algebra; shape, space and measures, and handling data.

UML basics: An introduction to the Unified Modeling Language

BPMN Business Process Modelling Notation

Analytics for Performance Optimization of BPMN2.0 Business Processes

4.7 Business Process Model and Notation

Using Use Cases for requirements capture. Pete McBreen McBreen.Consulting

Fourth generation techniques (4GT)

PowerPoint 2007: Animations Contents

Using UML Part One Structural Modeling Diagrams

SMock A Test Platform for the Evaluation of Monitoring Tools

Syllabus M.C.A. Object Oriented Modeling and Design usung UML

Object Interaction. Object Diagrams. Object Diagrams Object

Managing Variability in Software Architectures 1 Felix Bachmann*

Business Modeling with UML

2-1 Position, Displacement, and Distance

Java: Learning to Program with Robots. Chapter 11: Building Quality Software

ATM Case Study Part 1

BIS 3106: Business Process Management. Lecture Two: Modelling the Control-flow Perspective

Mutual Exclusion using Monitors

INTRODUCTION TO BUSINESS PROCESS MODELING NOTATION BPMN 1.2 AND BPMN 2.0

Business Process Modelling Notation A tutorial

A-1. Chapter 1. Project planning. Chapter 1. Festo Didactic Mechatronics

Software Requirements

Dr. Jana Koehler IBM Zurich Research Laboratory

Process Modelling & Mapping: The Basics

MTAT Business Process Management (BPM) (for Masters of IT) Lecture 2: Introduction to BPMN

Writing Use Case Scenarios for Model Driven Development

Chapter 7, System Design Architecture Organization. Construction. Software

Paper Designing Web Applications: Lessons from SAS User Interface Analysts Todd Barlow, SAS Institute Inc., Cary, NC

Unit I Page No. 1 System Development Object Basics Development Life Cycle Methodologies Patterns Frameworks Unified Approach UML

3 Extending the Refinement Calculus

Moving from CS 61A Scheme to CS 61B Java

Menouer Boubekeur, Gregory Provan

ATM Case Study OBJECTIVES Pearson Education, Inc. All rights reserved Pearson Education, Inc. All rights reserved.

(Refer Slide Time: 2:03)

Transcription:

Sequence Diagrams Massimo Felici

What are Sequence Diagrams? Sequence Diagrams are interaction diagrams that detail how operations are carried out Interaction diagrams model important runtime interactions between the parts that make up the system Interactions Diagrams Sequence diagrams Interaction overview diagrams Timing diagrams Communication diagrams 1

What do Sequence Diagrams model? capture the interaction between objects in the context of a collaboration show object instances that play the roles defined in a collaboration show the order of the interaction visually by using the vertical axis of the diagram to represent time what messages are sent and when show elements as they interact over time, showing interactions or interaction instances do not show the structural relationships between objects 2

Slide 2: What do Sequence Diagrams model? Model high-level interaction between active objects in a system Model the interaction between object instances within a collaboration that realises a use case Model the interaction between objects within a collaboration that realizes an operation Either model generic interactions (showing all possible paths through the interaction) or specific instances of a interaction (showing just one path through the interaction Capture the interaction that takes place in a collaboration that either realises a use case or an operation (instance diagrams or generic diagrams) Capture high-level interactions between user of the system and the system, between the system and other systems, or between subsystems (sometimes known as system sequence diagrams)

Participants in a Sequence Diagram A sequence diagram is made up of a collection of participants Participants the system parts that interact each other during the sequence Classes or Objects each class (object) in the interaction is represented by its named icon along the top of the diagram 3

Slide 3: Participants in a Sequence Diagram In UML 1.x, participants were usually software objects (instances of classes) in object-oriented programming sense. In UML 2.0, as general modeling language, participants are also at the level of system parts.

Notations 4 Frames Lifelines Messages and Focus Control Combined Fragments Interaction Occurrences States Continuations Textual Annotation Tabular Notation Sequence Diagrams

Frames 5

Slide 5: Sequence Diagrams Dimensions Time. The vertical axis represents time proceedings (or progressing) down the page. Note that Time in a sequence diagram is all a about ordering, not duration. The vertical space in an interaction diagram is not relevant for the duration of the interaction. Objects. The horizontal axis shows the elements that are involved in the interaction. Conventionally, the objects involved in the operation are listed from left to right according to when they take part in the message sequence. However, the elements on the horizontal axis may appear in any order.

Lifelines 6 Sequence diagrams are organised according to time Each participant has a corresponding lifeline Each vertical dotted line is a lifeline, representing the time that an object exists Lifeline name: [connectable-element-name][ [ selector ] ][:class-name][decomposition]

Examples 7 Syntax seoclecturer seoclecturer:lecturer :Lecturer lecturer[i] s ref sd3 self Lifelines Names Explanation An object named secolecturer An object named seoclecturer of class Lectuer An anonymous object of class Lecturer The object lecturer that is selected by the index value i A subsystem s whose internal interaction is shown in sequence diagram sd3 (decomposition) The connectable element that owns the interaction shown in the sequence diagram

Messages and Focus of Control 8

Slide 8: Messages and Focus of Control Focus of control (execution occurrence): an execution occurrence (shown as tall, thin rectangle on a lifeline) represents the period during which an element is performing an operation. The top and the bottom of the of the rectangle are aligned with the initiation and the completion time respectively. An Event is any point in an interaction where something occurs.

Messages 9 Messages (or signals) on a sequence diagram are specified using an arrow from the participant (message caller) that wants to pass the message to the participant (message receiver) that is to receive the message A Message (or stimulus) is represented as an arrow going from the sender to the top of the focus of control (i.e., execution occurrence) of the message on the receiver s lifeline

Message Message Type Notations Description Synchronous: A synchronous message between active objects indicates wait semantics; the sender waits for the message to be handled before it continues. This typically shows a method call. Asynchronous: With an asynchronous flow of control, there is no explicit return message to the caller. An asynchronous message between objects indicates no-wait semantics; the sender does not wait for the message before it continues. This allows objects to execute concurrently. Reply: This shows the return message from another message. 10

Message Message Type Notations Description Create: This message results in the creation of a new object. The message could call a constructor for a class if you are working with Java, for example. Lost: A lost message occurs whet the sender of the message is known but there is no reception of the message. This message allows advanced dynamic models to built up by fragments without complete knowledge of all the messages in the system. This also allows the modeler to consider the possible impact of a message s being lost. Found: A found message indicates that although the receiver of the message is known in the current interaction fragment, the sender of the message is unknown. 11

Slide 11: Message Type Notations Element Creation: when an element is created during an interaction, the communication that creates the element is shown with its arrowhead to the element Element Destruction: When an element is destroyed during an interaction, the communication that destroys the element is shown with its arrowhead to the elements lifeline where the destruction is marked with a large symbol

Message Syntax Slide 11: Message and Argument Syntax [attribute=] signal-or-operation-name [(argument)] [:return-value] * Argument syntax [parameter-name=] argument-value attribute=out-parameter-name [:argument-value] -

Slide 11: Types of Communications Reflexive Communications: similar to a reflexive association or link, an element may communicate with itself where communication is sent from the element to itself. Sending messages to itself means an object has two activations simultaneously. Repetitions: involve repeating a set of messages or stimuli within a generic-form interaction. Messages are grouped together in a rectangle. The expression in square brackets, [ ], is a condition. The asterisk * means iteration. Conditionality: branching results in a choice of two different messages (or operation calls) being sent to the same object, the lifeline of the object splits with two activations. The separate lifelines merge back together after the completion of different actions in response to the different messages. Return Values: often worthwhile to label the return value because it may be used later in the interaction.

Example 12 A sequence diagram for distributed control

Sequence Fragments 13 UML 2.0 introduces sequence (or interaction) fragments Sequence fragments make it easier to create and maintain accurate sequence diagrams A sequence fragment is represented as a box, called a combined fragment, which encloses a portion of the interactions within a sequence diagram The fragment operator (in the top left cornet) indicates the type of fragment Fragment types: ref, assert, loop, break, alt, opt, neg

Notation 14 Sequence Fragments

Operator Common Operators for Interaction Frames Meaning alt Alternative multiple fragments: only the one whose condition is true will execute. opt Optional: the fragment executes only if the supplied condition is true. Equivalent to an alt only with one trace. par Parallel: each fragment is run in parallel. loop Loop: the fragment may execute multiple times, and the guard indicates the basis of iteration. region Critical region: the fragment can have only one thread executing it at once. neg Negative: the fragment shows an invalid interaction. ref Reference: refers to an interaction defined on another diagram. The frame is drawn to cover the lifelines involved in the interaction. You can define parameters and a return value. sd Sequence diagram: used to surround an entire sequence diagram. 15

Slide 15: Combined Frames It is possible to combine frames in order to capture, e.g., loops or branches. Combined fragment keywords: alt, opt, break, par, seq, strict, neg, critical, ignore, consider, assert and loop Other ways in UML 2.0 of hiding information are by interaction occurrences and continuations

Example 16 Interaction Frames

Other Notations 17 States - it is possible to place states on lifelines (e.g., pre and post conditions) Textual notations (e.g., comments, time constraints, duration constraints) Tabular notation

Timing 18 Constraints are usually used to show timing constraints on messages. They can apply to the timing of one message or intervals between messages. Durations The duration of activations or the time between messages can be show with construction marks.

Slide 18: Timing Label the points of issue and return for a message. Use these labels in expressing timing constraints. This technique also works for message sending that takes time (so arrows are sloping down). Metric information in the diagram contribute to representing timing, but this is not recommended (why not?). Although if the line representing the message is horizontal, it is unclear whether it applies to the time the message is sent or received

Example 19 Timing

How to Produce Sequence Diagrams 1. Decide on Context: Identify behavior (or use case) to be specified 2. Identify structural elements: (a) Model objects (classes) (b) Model lifelines (c) Model activations (d) Model messages (e) Model Timing constraints 3. Refine and elaborate as required 20

When to Use Sequence Diagrams You should use sequence diagrams when you want to look at the behaviour of several objects within a single use case. Sequence diagrams are good at showing collaborations among the objects. They are not so good at precise definition of behaviour. 21

Check use cases How do Interaction Diagrams help? Check class can provide an operation showing how a class realizes some operation by interacting with other objects Describe design pattern parameterising by class provides a scheme for a generic interaction (part of Software Architecture) Describe how to use a component capturing how components can interact 22

Required Readings 23 UML course textbook, Chapter 9 on Interaction Sequence Diagrams

Summary 24 Sequence Diagrams capture some elements of the dynamics of systems support a number of different activities describe interaction in some detail, including timing Dimensions Objects and Time Basics Objects, Lifelines, Activations, Messages, etc. Timing