0% found this document useful (0 votes)
31 views19 pages

Sequence Diagrams

ase

Uploaded by

Ramsha Tariq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views19 pages

Sequence Diagrams

ase

Uploaded by

Ramsha Tariq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Sequence Diagrams

Interaction Diagrams
• UML Specifies a number of interaction diagrams to model dynamic
aspects of the system
• Dynamic aspects of the system
• Messages moving among objects/classes
• Flow of control among objects
• Sequences of events
Dynamic Diagram Types
• Interaction Diagrams - Set of objects or roles and the messages that can be
passed among them.
• Sequence Diagrams - emphasize time ordering
• Communication Diagrams - emphasize structural ordering
• State Diagrams
• State machine consisting of states, transitions, events and activities of an
object
• Activity & Swimlane Diagrams
• Emphasize and show flow of control among objects
Sequence Diagrams
• Describe the flow of messages, events, actions between objects

• Show concurrent processes and activations

• Show time sequences that are not easily depicted in other


diagrams

• Typically used during analysis and design to document and


understand the logical flow of your system
Emphasis on time ordering!
Sequence Diagram
Sequence Diagram
Time Increasing -->

All lines should be horizontal to indicate


instantaneous actions. Additionally if ActivityA
happens before ActivityB, ActivityA must be above
activity A
Lower = Later!
Diagonal Lines
:Student :Registration
System
Time=A GetDetails()

Time=B

• What does this mean?

Do you typically care?


Components
Objects: aStudent is a specific
instance of the Student class

Specific Generic (unnamed)


Generic
objects(unnamed)
Instance of objects of class type Seminar
an and Course
Object
Components

execution
lifeline
Components

Method call

Return value
Components
c : Client o : ODBCProxy
create() :
Transaction
setActions(a, b, c)
setValues(a, 3, 4)

setValues(b, c, 7)

(committed)
destroy()

create()
destroy()
Synchronous message
Asynchronous message
Return message
Async Message Example

There are problems here… what are they?

Synchronous message
Asynchronous message
Return message
Components: alt/else
Components: option
Components: loop
Rules of thumb
• Rarely use options,loops,alt/else
• These constructs complicate a diagram and make them
hard to read/interpret.
• Frequently it is better to create multiple simple diagrams

• Create sequence diagrams for use cases when it helps


clarify and visualize a complex flow

• Remember: the goal of UML is communication and


understanding
Summary
• Sequence diagrams model object interactions with an emphasis
on time ordering
• Method call lines
• Must be horizontal!
• Vertical height matters! “Lower equals Later”
• Label the lines
• Lifeline – dotted vertical line
• Execution bar – bar around lifeline when code is running
• Arrows
• Synchronous call (you’re waiting for a return value) – triangle
arrow-head
• Asynchronous call (not waiting for a return) – open arrow-head
• Return call – dashed line
In class exercise
• Draw a sequence diagram for:
• Getting on a flight. Start at home, check in at the counter, go through
security, and end up at the gate. (If you have time during the exercise, get
yourself to your seat.)
• You may get searched in security
In class exercise
• Draw a sequence diagram for:
• Getting money from an ATM machine
• Treat each part of the ATM as a class
• Money dispenser
• Screen
• Keypad
• Bank computer
• Etc…

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy