SW-Lecture 7 - Sequence Diagram
SW-Lecture 7 - Sequence Diagram
Lecture 6
Interaction Models
• This can be user interaction, which involves user inputs and outputs
• Interaction between the system being developed and other systems
• Or interaction between the components of the system
Actors Objects
Sequence Diagram Notation
:Object 1 :Object 2
Lifelines
Identify the existence of the object over time.
Sequence Diagram Notation
:Object 1 :Object 2
Activations
Indicate when an object is performing an action
Sequence Diagram Notation
:Object 1 :Object 2
message
Messages
Indicate the communications between objects
Sequence Diagram Notation
:Object 1 :Object 2
message
message
Sequence
Vertical position signifies sequence – earlier
messages appear nearer the top.
Sequence Diagram (make a phone call)
A Simpler Example - Sending an email
E-mail Interface
Working From a Scenario
Sending an email
: user
Add Objects
The first interaction is with the icon bar, which we can treat as an
object
: icon bar
: user
Add Message
The user talks to the icon bar
: icon bar
: user
Label The Communication
: icon bar
: user
click send mail
: user
click send mail create
Now the user can see the email page and use it.
The next three steps are filling in the details on
the email page
: user
click send mail create
fill in to box
fill in subject box
fill in contents box
The User then clicks Send
: icon bar : email page
: user
click send mail create
fill in to box
fill in subject box
fill in contents box
send
Now consider how to do the sending
: icon bar : email page : address book
: user
click send mail create
fill in to box
fill in subject box
fill in contents box
send
look up email address
: user
click send mail create
fill in to box
fill in subject box
fill in contents box
send
look up email address
: user
click send mail create
fill in to box
fill in subject box
fill in contents box
send
look up email address
submit email
And if we think carefully, the email page always closes after
the send.
: icon bar : email page : address book : email server
: user
click send mail create
fill in to box
fill in subject box
fill in contents box
send
look up email address
submit email
close
Now we go through and change the messages to
operations on the object
: user
send mail( ) create
fill in to box
fill in subject box
fill in contents box
send
look up email address
submit email
close
And so on, all the way through
: user
send mail( ) create( )
enterTo( )
enterSubject( )
enterContents( )
send( )
getEmailAddress( )
submitEmail( )
close( )
And now we have found our objects, and the operations on
them
email page
create()
icon bar enterTo() address book
enterSubject()
send mail() enterContents() getEmailAddress()
send()
close()
email server
submitEmail()
• Suggestion:
:System
System Sequence Diagrams
• For a particular scenario of use-case an SSD shows-
• The external actors that interact directly with the system.
:Object1
Notation (2)
• Actor: An Actor is modeled using the usual symbol, the stick figure.
actor1
Notation (3)
• Lifeline: The LifeLine identifies the existence of the object
over time. The notation for a Lifeline is a vertical dotted line
extending from an object.
Notation (4)
• Message: Messages, modeled as horizontal arrows between Activations,
indicate the communications between objects.
messageName(argument)
Example of an SSD