0% found this document useful (0 votes)
17 views43 pages

SW-Lecture 7 - Sequence Diagram

The document discusses sequence diagrams as a tool for modeling interactions between system components, emphasizing the flow of messages and time sequences. It outlines the key parts of sequence diagrams, the steps for developing them, and the differences between system sequence diagrams and regular sequence diagrams. Additionally, it provides examples and exercises for creating sequence diagrams in the context of user interactions with a system.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views43 pages

SW-Lecture 7 - Sequence Diagram

The document discusses sequence diagrams as a tool for modeling interactions between system components, emphasizing the flow of messages and time sequences. It outlines the key parts of sequence diagrams, the steps for developing them, and the differences between system sequence diagrams and regular sequence diagrams. Additionally, it provides examples and exercises for creating sequence diagrams in the context of user interactions with a system.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 43

Sequence Diagrams

Lecture 6
Interaction Models

All systems involve interaction of some kind…

• 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

Use case modeling, which is mostly used to model interactions


between a system and external actors (users or other systems).

Sequence diagrams are used to model interactions between system


components, although external agents may also be included.
Sequence Diagrams

• Describe the flow of messages, events, actions between


objects

• Show time sequences that are not easily depicted in other


diagrams

• Typically used to understand the logical flow of system

• Emphasis on time ordering!


Sequence Diagram Key Parts

• In a sequence diagram, objects and actors are aligned along


the top of the diagram.

• Labeled arrows indicate operations; the sequence of


operations is from top to bottom.

• The axes in a sequence diagram:

– horizontal: Represents that which object/participant is acting


– vertical: Represents time sequence
Developing Sequence Diagrams
There are four main steps to draw sequence diagram:

• Identify the relevant objects involved in the computation

• Establish the role of each object

• Identify the controller

• Decide messages between objects


Sequence Diagram Notation

Object1 name:classname Object 2name:classname

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

1. Press “New ” email icon


2. Enter person’s name in “To” section
3. Type subject
4. Type contents
5. Press Send button
6. System looks up email address in address book
7. System submits the email to the email server
Starting The Diagram
• If this is an interactive scenario, we always have an actor
driving it

: 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

Remember that actors can only communicate with interface


objects such as screens, menus and icon bars.
The icon bar has some work to do.
It creates an email page.

: icon bar : email page

: 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

: icon bar : 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

We can choose to get the email page to look up the email


address from an address book object
The arrow allows information to return
: 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

So we don’t need to put a return arrow with the email


address going back to the email page
We can choose to get the email page to submit the email
to the email server

: 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
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

: icon bar : email page : address book : email server

: 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

: icon bar : email page : address book : email server

: 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()

So we drag them onto a class diagram


Introduction – System Sequence Diagram

• A system sequence diagram is a fast and easily created artifact

that illustrates input and output events related to the systems


under discussion
• Before proceeding to a logical design of how a software

application will work, we should investigate and define the


system behavior as a "black box“.
System sequence diagram

• A system sequence diagram (SSD) is a picture that shows, for

a particular scenario of a use case, the events that external


actors generate, their order, and inter-system events.
• An SSD is generated from inspection of a use case

• Suggestion:

• One SSD – one Use Case


System Sequence Diagram vs Sequence Diagram

• A System Sequence Diagram is an artifact that illustrates input


and output events related to the system under discussion.

• System Sequence Diagrams are typically associated with use-


case realization in the logical view of system development.

• Sequence Diagrams (Not System Sequence Diagrams) display


object interactions arranged in time sequence.
Sequence Diagrams
• Sequence Diagrams depict the objects and classes involved in the
scenario and the sequence of messages exchanged between the
objects needed to carry out the functionality of the system.
SSD—System Behavior

• System behaves as “Black Box”.


• Interior objects are not shown, as they would be on a Sequence Diagram.

:System
System Sequence Diagrams
• For a particular scenario of use-case an SSD shows-
• The external actors that interact directly with the system.

• The System (as a black box).

• The system events that the actors generate.

• The operations of the system in response to the events generated.

• System Sequence Diagrams depict the sequential order of the


events.
• System Sequence Diagrams should be done for the main success
scenario of the use-case, and frequent and alternative scenarios.
Notation
• Object: Objects are instances of classes. Object is represented as a
rectangle which contains the name of the object underlined.
• Because the system is instantiated, it is shown as an object.

: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

• Following example shows the success scenario of the Process


Sale use case.
• Events generated by cashier (actor)-
• makeNewSale
• enterItem
• endSale and
• makePayment.
SSD for Process Sale scenario
Exercise
Consider the following scenario and draw sequence diagram for
online book shop.

“Online customer can search book catalog, view description of


a selected book, add book to shopping cart, do checkout”.
Assignment
• Draw Sequence Diagrams of your assigned project for
each operation/feature of your system using MS Visio.
Note: If you have 10 functional requirements then you have to draw
10 sequence diagrams.

You might also like