system sequence diagrams

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

Upload: navisingla

Post on 26-Dec-2015

13 views

Category:

Documents


0 download

DESCRIPTION

SEquence Diagrams in UML(Intraction and communication diagram)

TRANSCRIPT

Page 1: System Sequence Diagrams

System Sequence System Sequence DiagramsDiagrams

Based on Craig Larman, Chapter Based on Craig Larman, Chapter 1010

and Anuradha Dharani’s notesand Anuradha Dharani’s notes

Page 2: System Sequence Diagrams

Dynamic behaviorsDynamic behaviors Class diagrams represent Class diagrams represent staticstatic relationships. Why? relationships. Why? What about modeling What about modeling dynamicdynamic behavior? behavior? InteractionInteraction diagrams model how groups of object diagrams model how groups of object

collaborate to perform some behaviorcollaborate to perform some behavior Typically captures the behavior of a single use caseTypically captures the behavior of a single use case

Use Case: Order Entry Use Case: Order Entry 1) An Order Entry window sends a “prepare” message to an 1) An Order Entry window sends a “prepare” message to an OrderOrder2) The Order sends “prepare” to each Order Line on the 2) The Order sends “prepare” to each Order Line on the OrderOrder3) Each Order Line checks the given Stock Item3) Each Order Line checks the given Stock Item4) Remove appropriate quantity of Stock Item from stock 4) Remove appropriate quantity of Stock Item from stock 5) Create a deliver item5) Create a deliver item

Alternative: Insufficient StockAlternative: Insufficient Stock3a) if Stock Item falls below reorder level3a) if Stock Item falls below reorder level

then Stock Item requests reorderthen Stock Item requests reorder  

Page 3: System Sequence Diagrams

Sequence diagrams Vertical line is called an object’s Vertical line is called an object’s lifelinelifeline

Represents an object’s life during interactionRepresents an object’s life during interaction Object deletion denoted by X, ending a lifelineObject deletion denoted by X, ending a lifeline

Horizontal arrow is a message between two objectsHorizontal arrow is a message between two objects Order of messages sequences top to bottomOrder of messages sequences top to bottom Messages labeled with message nameMessages labeled with message name

Optionally arguments and control informationOptionally arguments and control information Control information may express conditions: Control information may express conditions:

such as [hasStock], or iterationsuch as [hasStock], or iteration Returns (dashed lines) are optionalReturns (dashed lines) are optional

Use them to add clarityUse them to add clarity

Page 4: System Sequence Diagrams

A time for systems analysisA time for systems analysis”To every thing there is a season, and a time to every ”To every thing there is a season, and a time to every

purpose under heaven.” Ecclesiastes 3:1purpose under heaven.” Ecclesiastes 3:1

What UP phase are your projects in?What UP phase are your projects in? What have you determined about your projects?What have you determined about your projects? Preliminary requirements analysis determines a Preliminary requirements analysis determines a

vision and scope, use cases, risks and estimatesvision and scope, use cases, risks and estimates I.e., is there a project worthy of pursuing?I.e., is there a project worthy of pursuing? Next comes systems analysis:Next comes systems analysis:

Clarifies Clarifies input and output System events and which input and output System events and which Objects trigger themObjects trigger them

Generates System Sequence Diagrams from Use Generates System Sequence Diagrams from Use CasesCases

Why does this activity make sense now?Why does this activity make sense now?

Page 5: System Sequence Diagrams

System Sequence Diagram (SSD)System Sequence Diagram (SSD)For a use case scenario, an SSD shows:For a use case scenario, an SSD shows: The System (as a black box) The System (as a black box) The external actors that interact with The external actors that interact with

SystemSystem The System events that the actors The System events that the actors

generategenerate SSD shows operations of the System in SSD shows operations of the System in

response to events, in temporal orderresponse to events, in temporal order Develop SSDs for the main success Develop SSDs for the main success

scenario of a selected use case, then scenario of a selected use case, then frequent and salient alternative scenariosfrequent and salient alternative scenarios

:System

Page 6: System Sequence Diagrams

SSD for Process Sale scenarioSSD for Process Sale scenario(Larman, page 175)(Larman, page 175)

Page 7: System Sequence Diagrams

From Use Case to From Use Case to Sequence System DiagramSequence System Diagram

How to construct an SSD from a use case:How to construct an SSD from a use case:1.1. Draw System as black box on right side Draw System as black box on right side

2.2. For each actor that directly operates on For each actor that directly operates on the System, draw a stick figure and a the System, draw a stick figure and a lifeline.lifeline.

3.3. For each System events that each actor For each System events that each actor generates in use case, draw a message.generates in use case, draw a message.

4.4. Optionally, include use case text to left of diagram.Optionally, include use case text to left of diagram.

Page 8: System Sequence Diagrams

Example: use cases to SSDExample: use cases to SSD

Page 9: System Sequence Diagrams

Identifying the right ActorIdentifying the right Actor

In the process Sale example, does the In the process Sale example, does the customer interact directly with the POS customer interact directly with the POS system? system?

Who does?Who does? Cashier interacts with the system directlyCashier interacts with the system directly Cashier is the generator of the system eventsCashier is the generator of the system events Why is this an important observation?Why is this an important observation?

Page 10: System Sequence Diagrams

Naming System events & Naming System events & operationsoperations

System events and associated system System events and associated system operations should be expressed at the level operations should be expressed at the level of intent of intent

Rather than physical input medium or UI Rather than physical input medium or UI widgetwidget

Start operation names with verb (from use Start operation names with verb (from use case)case)

Which is better, scanBarCode or enterItem?Which is better, scanBarCode or enterItem?

Page 11: System Sequence Diagrams

SSDs and the GlossarySSDs and the Glossary in in parallelparallel

Why is updating the glossary Why is updating the glossary important when developing the SSD?important when developing the SSD?

New terms used in SSDs may need New terms used in SSDs may need explanation, especially if they are not explanation, especially if they are not derived from use cases derived from use cases

A glossary is less formal, easier to A glossary is less formal, easier to maintain and more intuitive to maintain and more intuitive to discuss with external parties such as discuss with external parties such as customerscustomers

Page 12: System Sequence Diagrams

SSDs within the Unified ProcessSSDs within the Unified ProcessCCreatereate System Sequence Diagrams during System Sequence Diagrams during

Elaboration in order to:Elaboration in order to: Identify System events and major operationsIdentify System events and major operations Write System operation contracts (Contracts Write System operation contracts (Contracts

describe detailed system behavior) describe detailed system behavior) Support better estimatesSupport better estimates Remember, there is a season for everything:Remember, there is a season for everything:

it is not necessary to create SSDs for all it is not necessary to create SSDs for all scenarios of all use cases, at least not at the scenarios of all use cases, at least not at the same timesame time

Page 13: System Sequence Diagrams

Concurrency in Sequence Diagrams Concurrent processes: Concurrent processes:

UML 1: UML 1: asynchronousasynchronous messages as horizontal messages as horizontal lines with lines with halfhalf arrow heads arrow heads

UML 2 makes this distinction by not filling an UML 2 makes this distinction by not filling an arrowhead arrowhead

Fowler prefers older notation. Fowler prefers older notation. Why? Which do you prefer?Why? Which do you prefer?

After setting up Transaction Coordinator, After setting up Transaction Coordinator, invoke concurrent Transaction Checkersinvoke concurrent Transaction Checkers

If a check fails, kill all Transaction Checker If a check fails, kill all Transaction Checker processesprocesses

Note use of comments in marginNote use of comments in margin When is this a good idea?When is this a good idea?

Page 14: System Sequence Diagrams

Collaboration diagramsCollaboration diagrams Objects are rectangular iconsObjects are rectangular icons

e.g., Order Entry Window, Order, etc.e.g., Order Entry Window, Order, etc. Messages are arrows between iconsMessages are arrows between icons

e.g., prepare()e.g., prepare() Numbers on messages indicate sequenceNumbers on messages indicate sequence

Also spatial layout helps show flowAlso spatial layout helps show flow Which do you prefer: sequence or collaboration Which do you prefer: sequence or collaboration

diagrams?diagrams? Fowler now admits he doesn’t use collaboration Fowler now admits he doesn’t use collaboration

diagramsdiagrams Interaction diagrams show flow clearly, Interaction diagrams show flow clearly,

but are awkward when modeling alternativesbut are awkward when modeling alternatives UML notation for control logic has changed in UML 2 UML notation for control logic has changed in UML 2

but Fowler isn’t impressedbut Fowler isn’t impressed