UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor:...

58
UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU

Transcript of UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor:...

Page 1: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

UML Diagrams:Sequence Diagrams

The Requirements Model, andThe Dynamic Analysis Model

Instructor: Dr. Hany H. Ammar

Dept. of Computer Science and Electrical Engineering, WVU

Page 2: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Outline

Review of previous Lecture The Requirements Model and the Analysis model Importance of Sequence Diagrams Rules of sequence diagrams Use Cases and Sequence Diagrams The System Sequence Diagrams The Sound Recorder Example The E-Commerce Example Other Examples

Page 3: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Review of Previous lecture

Review of development phases and UML Development - Overview Introduction and importance of Use Case Diagrams Use Case Diagram Rules Examples of Use Case diagrams Requirements Elicitation Process

1. Identify Actors2. Identify Scenarios3. Identify Use Cases4. Refine Use Cases5. Identify Relationships between actors and Use Cases6. Identify Initial Analysis Objects7. Identify Non-functional requirements

Page 4: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Requirements, Use cases, and Scenarios

Page 5: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

UML Development - Overview

PROGRAM

ACTORS

ANALYSISSpecify Domain Objects

Detailed DESIGN

IMPLEMENTATION

DATA

DICTION

ARY

TimeUSE CASES

ANALYSISCLASS DIAGRAM(S)

IMPLEMENTATIONActivity DIAGRAMS

System/ObjectSEQUENCEDIAGRAMS

OPERATION CONTRACTS

StateChart DIAGRAMs

DEPLOYMENT DIAGRAMSUBSYSTEM CLASS/OR COMPONENT

DIAGRAMS

Architectural DesignIncludeDesign Objects

ObjectDesign

SCENARIOS

REQUIREMENTSELICITATION

DESIGN DIAGRAMS

IMPLEMENTATIONCHOICES

DESIGN SEQUENCE DIAG.

RequirementsEngineering

Page 6: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Where are we in the Requirements Engineering ?

Requirements Engineering focus: elicitation and analysis

Page 7: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

The Requirements Model and the Analysis Model

Static Analysis Dynamic Analysis

Functional/ NonfunctionalRequirements

Use Case Diagrams/Sequence Diagrams(the system level)

- Class Diagrams- State Diagrams/Refined Sequence Diagrams (The object level)

The Requirements ElicitationProcess

The Object-OrientedAnalysisProcess

Page 8: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Outline

The Requirements Model and the Analysis model Introduction to Requirements Engineering Importance of Sequence Diagrams Rules of sequence diagrams Use Cases and Sequence Diagrams The System Sequence Diagrams The Sound Recorder Example The E-Commerce Example Other Examples

Page 9: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Importance of Sequence Diagrams

Depict object interactions in a given scenario identified for a given Use Case

Specify the messages passed between objects using horizontal arrows including messages to/from external actors

Time increases from Top to bottom

Page 10: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Rules of Sequence Diagrams

Sequence Initiation

updateStatus( )

Click Update Button

User

Object1:C1 Object2:C2

Page 11: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Rules of Sequence Diagrams

Identify objects needed to support use cases, determine sequence of internal events following the external initiating event

Diagrams that are not initiated with an external actor represent only a partial sequence

Partial sequence diagrams should clearly identify the actor initiated sequence diagrams from which they are launched

Page 12: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Example of Sequence Diagrams Notation

Page 13: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Rules of Sequence Diagrams

Messages specified on interactions can be synchronous or asynchronous

updateStatus( )

Object1:C1 Object2:C2

calcRoute( )

route

Object1:C1 Object2:C2

Implicit Returns Explicit Return

Object3:C3

generateMessage( )

Synchronous call

Page 14: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Rules of Sequence Diagrams

Asynchronous call

asynchronous_Call ()

callBack ()

Object1:C1{active}

Object2:C2{active}

Page 15: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Rules of Sequence Diagrams

Display operation names on call arrows

c:clientfactory:

cmd_pktCToCHeaderFactory

header:cmd_pktCToCCommandHeaderbuildHeader( char * )

«create»

header

Page 16: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Rules of Sequence Diagrams

 Compound and Simple Iteration

* [for allInterfaces inContainer] Find( )

amMasterSI( )

setState( )

getInterfaceContainer()

* [for all Interfaces in Container] publishState() setOn( ) / setOff( )

{

:DiscreteFD:DiscreteFD

:Interface:Interface:InterfaceContainer:Subsystem :Resource

Page 17: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

 Numbering the Sequence of Interactions

Page 18: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

‘included’ sequence diagrams

Command Response

Command Request

Command Request

Command Response<<includes>>Process CommandResponse sequence

<<includes>>Process CommandRequest sequence

Application Process with CIF

CMM:process target:process

Page 19: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Showing alternate behavior in a sequence

diagram

validateCommand( )

issueCommand( )

User Application

[if valid command] routeCommand( )

[if invalid command] logError( )

display(status)

:CmdHandler :CmdValidater :CmdRouter :EventLog :StatusDialog

Page 20: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Showing Extension Point

validateCommand( )

routeCommand( )

display( status)

Extension Point[invalid command]

abort commandrequest and sendsystem message

:StatusDialog:CmdRouter:CmdValidater:CmdHandler

issueCommand( )

User Application

Page 21: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.
Page 22: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Rules of Sequence Diagrams Showing alternate behavior in a sequence diagram

Page 23: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.
Page 24: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.
Page 25: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Communication/Collaboration Diagrams

Page 26: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Specifying Timing Requirements

a: Command

Create Transaction

b: Command

d: ResponseRemove Transaction

c: Response

CMM : process target : process

User Application

{b.receiveTime a.sendTime + 50ms}

{d.receiveTime a.sendTime + 1s}

Page 27: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.
Page 28: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Specifying Timing Requirements

Page 29: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Specifying Timing Requirements (Data rates in notes)

Page 30: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Specifying Timing Requirements

Page 31: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Specifying Timing Requirements (ave and max)

Page 32: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Specifying Timing Requirements: (Timeout events)

Page 33: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Outline

The Requirements Model and the Analysis model Introduction to Requirements Engineering Importance of Sequence Diagrams Rules of sequence diagrams Use Cases and Sequence Diagrams The System Sequence Diagrams The Sound Recorder Example The E-Commerce Example Other Examples

Page 34: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Recall Requirements Elicitation Process

The process of requirements elicitation consists of the following steps

1. Identify Actors

2. Identify Scenarios

3. Identify Use Cases

4. Refine Use Cases

5. Identify Relationships between actors and Use Cases

6. Identify Initial Analysis Objects

7. Identify Non-functional requirements

Page 35: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Requirements Elicitation ProcessStep 4. Refining Use Cases

System Sequence Diagrams System sequence diagrams establish the dynamic behavior

in terms of key scenarios of the system for each use case The system sequence diagram models a scenario of the

system interactions with the environment for a given use case

Input/output events are clearly identified in each sequence diagram,

The State of the system before and after each event are also depicted

Different diagrams model scenarios with the normal flow of events and the abnormal flow of events

Page 36: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Sequence Diagrams and Use CasesSystem Sequence Diagram

The sequence diagram of use case UC1 for system S

A cto r1A cto r2

S y s te m: S

S1

S2

S3

S4

E 11

L i s t o f G u i d e W o r d s

L i s t o f G u i d e W o r d s

L i s t o f G u i d e W o r d s

L i s t o f G u i d e W o r d s

L i s t o f G u i d e W o r d s

E 2 1

E 1 2

E 2 2

E 3 2E 4 1

E 3 1

L i s t o f G u i d e W o r d s

L i s t o f G u i d e W o r d s

The use case diagramOf system S

Page 37: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

UML Use Case Diagrams: The Requirements Model

CaseStudy

Page 38: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

UML Use Case Diagrams: The Requirements Model- System Seq. Diags. Digital Sound Recorder Case Study

A sequence diagram displays object interactions arranged in a time sequence capturing a specific scenario of interactions in a use case supported by the system

Time

System SequenceDiagram for Play MassageScenario: Normal Flow

Page 39: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Sys. Seq. Diagram for Alarm sounding while playing Massage Scenario

Page 40: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Sys. Seq. Diag. for Alarm while stand-by followed by No-power event.

Page 41: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

The ATM Example

Page 42: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.
Page 43: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.
Page 44: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

This is for the Banking Service Subsystem

Page 45: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.
Page 46: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.
Page 47: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Customer Supplier

Bank

Browse Catalog

Confirm Shipment

Process Delivery Order

Send InvoicePlace Requisition

Confirm Delivery

Example: Use Case Diagram of the E-Commerce System

Page 48: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Place Requisition Scenario

Page 49: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Confirm Delivery Scenario

Page 50: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Send Invoice Scenario

Page 51: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Confirm Shipment Scenario

Page 52: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.
Page 53: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Another Example: Pace Maker Use-Case model

Page 54: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Pace Maker Sys. Seq. Diag

Page 55: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Seq. Diag. at the object level (The Analysis Model)

Page 56: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

A Simple Example of Using UML2

EXAMPLE: SATELLITE CONTROL SYSTEM

Page 57: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

Example of Software Architecture Using UML2

SATELLITE CONTROL SYSTEM Architecture

Page 58: UML Diagrams: Sequence Diagrams The Requirements Model, and The Dynamic Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical.

A Simple Example Using UML2

SATELLITE CONTROL SYSTEM Architectural behavior