Use Case Sequence Diagram. Slide 1

Similar documents
What is a Class Diagram? Class Diagram. Why do we need Class Diagram? Class - Notation. Class - Semantic 04/11/51

What is a Class Diagram? A diagram that shows a set of classes, interfaces, and collaborations and their relationships

CSE 308. UML Sequence Diagrams. Reading / Reference.

Object Oriented Methods with UML. Lecture -4

INTRODUCTION TO UNIFIED MODELING MODEL (UML) & DFD. Slides by: Shree Jaswal

Lesson 11. W.C.Udwela Department of Mathematics & Computer Science

Sequence Diagrams. Massimo Felici. Massimo Felici Sequence Diagrams c

Class diagrams. Modeling with UML Chapter 2, part 2. Class Diagrams: details. Class diagram for a simple watch

Interactions A link message

Interaction Modelling: Sequence Diagrams

UNIT-IV BASIC BEHAVIORAL MODELING-I

Chapter 10. Object-Oriented Analysis and Modeling Using the UML. McGraw-Hill/Irwin

System Sequence Diagrams. Based on Craig Larman, Chapter 10 and Anuradha Dharani s notes

The learning objectives of this chapter are the followings. At the end of this chapter, you shall

KF5008 Program Design & Development. Lecture 3 Sequence Diagrams

Class diagrams. Modeling with UML Chapter 2, part 2. Class Diagrams: details. Class diagram for a simple watch

Object-Oriented Modeling. Sequence Diagram. Slides accompanying Version 1.0

Ali Khan < Project Name > Design Document. Version 1.0. Group Id: S1. Supervisor Name: Sir.

Software Specification 2IX20

Applying UML & Patterns (3 rd ed.) Chapter 15

Lecture 21 Detailed Design Dynamic Modeling with UML

Meltem Özturan

Question Sheet There are a number of criticisms to UML. List a number of these criticisms.

CS 370 REVIEW: UML Diagrams D R. M I C H A E L J. R E A L E F A L L

Sequence Diagram. A UML diagram used to show how objects interact. Example:

Chapter 15 UML Interaction Diagrams. Larman, C. Applying UML and Patterns. 3rd Ed. Ed. Prentice-Hall: 2005.

UNIT-4 Behavioral Diagrams

COMP 354: INTRODUCTION TO SOFTWARE ENGINEERING

Object-Oriented and Classical Software Engineering

Object-oriented design. More UML

12 Tutorial on UML. TIMe TIMe Electronic Textbook

SOFTWARE ENGINEERING UML FUNDAMENTALS. Saulius Ragaišis.

Introduction to Software Engineering. 6. Modeling Behaviour

Topics. Overview- The UML Functional Model. Structural Model. Behavioral Models. Use Case Diagram (essential and system)

Lecture 17: (Architecture V)

Sequence Diagram. r: Register s: Sale

UML Fundamental. OutLine. NetFusion Tech. Co., Ltd. Jack Lee. Use-case diagram Class diagram Sequence diagram

PROCESSES AND THREADS

Today s Agenda UML. CompSci 280 S Introduction to Software Development. 1.Introduction UML Diagrams. Topics: Reading:

7. UML Sequence Diagrams Page 1 of 1

STATE MACHINES. Figure 1: State Machines

Software Design Models, Tools & Processes. Lecture 3: Addendum Cecilia Mascolo

UML- a Brief Look UML and the Process

Software Engineering. Page 1. Objectives. Object-Behavioural Modelling. Analysis = Process + Models. Case Study: Event Identification

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)

UML Component Diagrams A.Y 2018/2019

UML part I. UML part I 1/41

A - 1. CS 494 Object-Oriented Analysis & Design. UML Class Models. Overview. Class Model Perspectives (cont d) Developing Class Models

CS211 Lecture: Modeling Dynamic Behaviors of Systems; Interaction Diagrams and Statecharts Diagrams in UML

Modeling Dynamic Behavior

Object-Interaction Diagrams: Sequence Diagrams UML

UML Sequence Diagrams for Process Views

CTIS 359 Principles of Software Engineering SOFTWARE DESIGN OO(A)D

Unified Modeling Language

Chapter 2: The Object-Oriented Design Process

SEQUENCE DIAGRAMS A sequence diagram captures the behavior of a single scenario. The diagram shows a number of example objects and the messages that a

COMP 6471 Software Design Methodologies

Last Time: Object Design. Comp435 Object-Oriented Design. Last Time: Responsibilities. Last Time: Creator. Last Time: The 9 GRASP Patterns

Integrating Word, Excel, Access, and PowerPoint

Pieter van den Hombergh. Fontys Hogeschool voor Techniek en Logistiek. September 9, 2016

UML Behavioral Models

Course "Softwaretechnik" Book Chapter 2 Modeling with UML

Object-Oriented Software Engineering Practical Software Development using UML and Java. Chapter 8: Modelling Interactions and Behaviour

Developing Shlaer-Mellor Models Using UML

Lab Manual. Object Oriented Analysis And Design. TE(Computer) VI semester

6/20/2018 CS5386 SOFTWARE DESIGN & ARCHITECTURE LECTURE 5: ARCHITECTURAL VIEWS C&C STYLES. Outline for Today. Architecture views C&C Views

Lecture 33 April 4, Unied Modelling Language. ECE155: Engineering Design with Embedded Systems Winter Patrick Lam version 1

CS211 Lecture: Modeling Dynamic Behaviors of Systems; Interaction Diagrams in UML

Compiler Theory. (Semantic Analysis and Run-Time Environments)

OBJECT ORIENTED DESIGN with the Unified Process. Use Case Realization

Chapter : Analysis Modeling

Instructor Info: Dave Tucker, LSSMBB ProModel Senior Consultant Office:

Object Oriented Modeling and Design

Principles of Software Construction: Objects, Design and Concurrency. Just enough UML. toad

Chapter 4. Capturing the Requirements. 4th Edition. Shari L. Pfleeger Joanne M. Atlee

Object Oriented Modeling

Fast Introduction to Object Oriented Programming and C++

LABORATORY 1 REVISION

Chapter 13: Query Processing

Pseudo Code and Flow Charts. Chapter 1 Lesson 2

Unified Modeling Language (UML) Object Diagram and Interaction Diagrams

Constantinos Constantinides Computer Science and Software Engineering Concordia University Montreal, Canada

Engineering Design w/embedded Systems

Word Overview Page 3 Tables Page 5 Labels Page 9 Mail Merge Page 12. Excel Overview Page 19 Charts Page 22

Unified Modeling Language (UML)

Software Development Cycle. Unified Modeling Language. Unified Modeling Language. Unified Modeling Language. Unified Modeling Language.

Chapter 12: Query Processing

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) MODEL ANSWER

! A relational algebra expression may have many equivalent. ! Cost is generally measured as total elapsed time for

Chapter 13: Query Processing Basic Steps in Query Processing

Specifying Precise Use Cases with Use Case Charts

Objectives. Explain the purpose and objectives of objectoriented. Develop design class diagrams

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) MODEL ANSWER

Information Expert (or Expert)

COSC 3351 Software Design. An Introduction to UML (I)

Programming Languages Third Edition. Chapter 9 Control I Expressions and Statements

Administrator Guide. v Decisions on Demand, Inc. - All Rights Reserved

2 UML for OOAD. 2.1 What is UML? 2.2 Classes in UML 2.3 Relations in UML 2.4 Static and Dynamic Design with UML. UML for OOAD Stefan Kluth 1

Enterprise Architect. User Guide Series. UML Models. Author: Sparx Systems. Date: 30/06/2017. Version: 1.0 CREATED WITH

SEEM4570 System Design and Implementation Lecture 11 UML

Transcription:

Use Case Sequence Diagram Slide 1

Interaction Diagrams l Interaction diagrams model the behavior of use cases by describing the way groups of objects interact to complete the task of the use case. They portray the interaction among the objects of a system and describe the dynamic behavior of the system. l l There are two types of interaction diagrams Sequence Diagrams and Communication Diagrams (formally known as collaboration diagrams) Slide 2

Interaction Diagrams l Sequence diagrams generally show the sequence of events that occur. l Collaboration diagrams demonstrate how objects are statically connected. l Both diagrams are relatively simple to draw and contain similar elements. Slide 3

Interaction Diagrams l Purpose of interaction diagrams Model interactions between objects Assist in understanding how a system (i.e., a use case) actually works Verify that a use case description can be supported by the existing classes Identify responsibilities/operations and assign them to classes Slide 4

Sequence Diagram l l Illustrates the objects that participate in a use case and the messages that pass between them over time for one use case In design, used to distribute use case behavior to classes Slide 5

Sequence Diagram X-Axis (objects) member: LibraryMember book:book :Book Copy Y-Axis (time) borrow(book) Message ok = mayborrow() [ok] borrow(member) Condition Life Line settaken(member) Object Focus of control Slide 6

Sequence Diagram Syntax AN ACTOR AN OBJECT anobject:aclass A LIFELINE A FOCUS OF CONTROL A MESSAGE amessage() OBJECT DESTRUCTION x Slide 7

Sequence Diagram Two major components Active objects Communications between these active objects Messages sent between the active objects Slide 8

Sequence Diagram Active objects Any objects that play a role in the system Participate by sending and/or receiving messages Placed across the top of the diagram Can be: An actor (from the use case diagram) Object/class (from the class diagram) within the system Slide 9

Active Objects Object Can be any object or class that is valid within the system Object naming Syntax [instancename][:classname] mybirthdy :Date 1. Class name only :Classname 2. Instance name only objectname 3. Instance name and class name together object:class Slide 10

Actor Active Objects A person or system that derives benefit from and is external to the system Participates in a sequence by sending and/or receiving messages Slide 11

Sequence Diagram Slide 12

Messages Communications between Active Objects Used to illustrate communication between different active objects of a sequence diagram Used when an object needs to activate a process of a different object to give information to another object Slide 13

Messages A message is represented by an arrow between the life lines of two objects. Self calls are allowed A message is labeled at minimum with the message name. Arguments and control information (conditions, iteration) may be included. Slide 14

Types of Messages Synchronous (flow interrupt until the message has completed) Asynchronous (don t wait for response) Flat (no distinction between sysn/async) Return (control flow has returned to the caller) Slide 15

Synchronous Messages l The routine that handles the message is completed before the calling routine resumes execution. :A :B Caller Blocked doyouunderstand() yes return (optional) Slide 16

Asynchronous Messages Calling routine does not wait for the message to be handled before it continues to execute. As if the call returns immediately Examples Notification of somebody or something Messages that post progress information Slide 17

Return Values Optionally indicated using a dashed arrow with a label indicating the return value. Don t model a return value when it is obvious what is being returned, e.g. gettotal() Model a return value only when you need to refer to it elsewhere (e.g. as a parameter passed in another message) Prefer modeling return values as part of a method invocation, e.g. ok = isvalid() Slide 18

Sequence Diagram X-Axis (objects) member: LibraryMember book:book :Book Copy Y-Axis (time) borrow(book) Message ok = mayborrow() [ok] borrow(member) Condition Life Line settaken(member) Object Focus of control Slide 19

Other Elements of Sequence Diagram Lifeline Focus of control (activation box or execution occurrence) Control information Condition, repetition Slide 20

Lifeline Sequence Diagram Denotes the life of actors/objects over time during a sequence Represented by a vertical line below each actor and object (normally dashed line) For temporary object place X at the end of the lifeline at the point where the object is destroyed Slide 21

Sequence Diagram Focus of control (activation box) Means the object is active and using resources during that time period Denotes when an object is sending or receiving messages Represented by a thin, long rectangular box overlaid onto a lifeline Slide 22

Sequence Diagram X-Axis (objects) member: LibraryMember book:book :Book Copy Y-Axis (time) borrow(book) Message ok = mayborrow() [ok] borrow(member) Condition Life Line settaken(member) Object Focus of control Slide 23

Control Information Condition syntax: [ expression ] message-label The message is sent only if the condition is true [ok] borrow(member) Slide 24

Elements of Sequence Diagram message() obj1:class [x < 15] calculate() obj2: Class Slide 25

Sequence Diagrams obj1:class obj2: Class obj3: Class message() [x < 15] calculate() [x > 20] calculate() Slide 26

Sequence Diagrams l Concurrency obj1:class obj2: Class obj3: Class message() calculate() calculate() Slide 27

Elements of Sequence Diagram Control information Iteration may have square brackets containing a continuation condition (until) specifying the condition that must be satisfied in order to exit the iteration and continue with the sequence may have an asterisk followed by square brackets containing an iteration (while or for) expression specifying the number of iterations Slide 28

Control Information Iteration syntax: * [ [ expression ] ] message-label The message is sent many times to possibly multiple receiver objects. *draw() Slide 29

Control Information Iteration example :CompoundShape :Shape :Driver :Bus draw() *draw() *[until full] insert() Slide 30

Control Information The control mechanisms of sequence diagrams suffice only for modeling simple alternatives. Consider drawing several diagrams for modeling complex scenarios. Don t use sequence diagrams for detailed modeling of algorithms (this is better done using activity diagrams, pseudo-code or state-charts). Slide 31

Sequence Diagrams Creation and destruction of an object in sequence diagrams are denoted by the stereotypes <<create>> and <<destroy>> :Creator <<create>> : Created Object message() <<destroy>> X Slide 32

Creating Objects Notation for creating an object onthe-fly Send the <<create>> message to the body of the object instance Once the object is created, it is given a lifeline. Now you can send and receive messages with this object as you can any other object in the sequence diagram. Slide 33

Object Creation An object may create another object via a <<create>> message. :A :B :A Preferred <<create>> <<create>> :B Constructor Slide 34

Object Destruction An object may destroy another object via a <<destroy>> message. An object may destroy itself. Avoid modeling object destruction unless memory management is critical. :A :B <<destroy>> Slide 35

Sequence Diagram Clerk lookup :Violations Dialog viewbutton() id=getid() :Violations Controller :Violations DBProxy Lookup Traffic Violation getviolation(id) <<create>> v:traffic Violation display(v) v DB is queried and the result is returned as an object Slide 36

Steps for Building a Sequence Diagram 1) Set the context 2) Identify which objects and actors will participate 3) Set the lifeline for each object/actor 4) Lay out the messages from the top to the bottom of the diagram based on the order in which they are sent 5) Add the focus of control for each object s or actor s lifeline 6) Validate the sequence diagram Slide 37

Steps for Building a Sequence Diagram 1) Set the context. a) Select a use case. b) Decide the initiating actor. Slide 38

Steps for Building a Sequence Diagram 2) Identify the objects that may participate in the implementation of this use case by completing the supplied message table. a) List candidate objects. 1) Use case controller class 2) Domain classes 3) Database table classes 4) Display screens or reports Slide 39

Steps for Building a Sequence Diagram 2) Identify the objects (cont.) b) List candidate messages. (in message analysis table) 1) Examine each step in the normal scenario of the use case description to determine the messages needed to implement that step. 2) For each step: 1) Identify step number. 2) Determine messages needed to complete this step. 3) For each message, decide which class holds the data for this action or performs this action 3) Make sure that the messages within the table are in the same order as the normal scenario Slide 40

Steps for Building a Sequence Diagram 2) Identify the objects (cont.) c) Begin sequence diagram construction. 1) Draw and label each of the identified actors and objects across the top of the sequence diagram. 2) The typical order from left to right across the top is the actor, primary display screen class, primary use case controller class, domain classes (in order of access), and other display screen classes (in order of access) 3) Set the lifeline for each object/actor Slide 41

Steps for Building a Sequence Diagram 4) Lay out the messages from the top to the bottom of the diagram based on the order in which they are sent. a) Working in sequential order of the message table, make a message arrow with the message name pointing to the owner class. b) Decide which object or actor initiates the message and complete the arrow to its lifeline. c) Add needed return messages. d) Add needed parameters and control information. Slide 42

Steps for Building a Sequence Diagram 5) Add the focus of control (activation box) for each object s or actor s lifeline. 6) Validate the sequence diagram. Slide 43

Sequence Diagrams :Cashier : System makenewsale() enteritem(itemid, quantity) description, total endsale() total makepayment(amount) change due, receipt Slide 44

Sequence Diagram Slide 45

Sequence Diagram Actor Compile :Compiler Linker Load Files FileSystem Compile files Save OBJ Files Link Load OBJ files Link OBJ files Write EXE file Slide 46