Types of Diagrams: - Structural Diagrams - Focus On Static Aspects of The Software System
Types of Diagrams: - Structural Diagrams - Focus On Static Aspects of The Software System
:Object 1 :Object 2
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
Objects
O1 O2 O3 O4 O5 indicates
that the
E1 event
E2 effects the
Events object
E3
E4
Sequence modelling
Moving on to the
next step of the
scenario
We now have a
third object!
: Print Invoice : Customer : Sales Items : Invoice
Record
Print Total
So we continue!
So what have we done?
• Worked through a Use Case scenario step by step
• Introduced a controller object to drive things
• Sent messages from one object to another
• Found objects to deal with the messages
What have we got left to do?
• Find operations on objects to support the messages
• Find attributes to support the objects
: Print Invoice : Customer : Sales Items : Invoice
Record
GetName( )
So we work
through the
messages and
apply
operations
: Print Invoice : Customer : Sales Items : Invoice
Record
GetName( )
PrintCustName( )
And so we
continue
: Print Invoice : Customer : Sales Items : Invoice
Record
GetName( )
PrintCustName( )
GetAddress( )
PrintCustAddress( )
GetUnbilledItems( )
PrintLines( )
PrintTotal( )
PrintTermsConditions( )
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
: 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.
: 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( )
Developing a Sequence Diagram
• Identify objects
• Identify relationships
• Identify operations
Sequence Diagrams
Object1
Underline on name
Represents time during
indicates object
which the object exists.
(vs class)
Return
The reply to a synchronous
message
Often not shown
Asynchronous
Sender does not wait for a reply
Flat
Don’t know or don’t care
Synchronous Messages
CheckBalance <<include>>
*
ValidateCustomer
* *
*
<<include>> BankingSystem
WithdrawCash
* *
<<include>>
*
Customer
<<extend>>
* TransferMoney PayBill
CollectUsageStats
* *
BankManager