You are on page 1of 48

Software

Requirements
Engineering
Interaction Models
• Interaction models shows the interaction between the components of a system,
or between the system being developed and other systems (or users)
• Modeling user interaction is important as it helps to identify user requirements
• 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, which are used to model interactions between system


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

• Sequence diagrams, commonly used by developers, model the interactions


between objects in a single use case. They illustrate how the different parts of a
system interact with each other to carry out a function, and the order in which
the interactions occur when a particular use case is executed
A Birds Eye View

Systems
Model

12/04/2021 CSE291 - Introduction to Software Engineering 5


Sequence Diagrams
• Sequence diagrams are part of the UML and are used to model the interactions
between the actors and the objects (and the objects themselves) within a system
• A sequence diagram shows the sequence of interactions that take place during a
particular use case or use case instance(flow)
• The objects and actors involved are listed along the top of the diagram, with a
dotted line drawn vertically from these
• Interactions between objects are indicated by annotated arrows (often referred
to as messages)
Sequence Diagram Notation

Object1 name:classname Object 2name:classname

Objects
Actors
:Object 1 :Object 2

Lifelines
Identify the existence of the object over time.
:Object 1 :Object 2

Activations
Indicate when an object is performing an action
:Object 1 :Object 2

message

Messages
Indicate the communications between objects
:Object 1 :Object 2

message
message

Sequence
Vertical position signifies sequence – earlier
messages appear nearer the top.
Example
• You read the sequence of interactions from top to bottom
• The annotations on the arrows indicate the calls to the objects, their parameters,
and the return values
• Sequence Diagrams show time sequences that are not easily depicted in other
diagrams
• Typically used to understand the logical flow of system
• A box labelled Alt is used to describe alternative scenarios of a workflow
Sequence Diagram
• Draw smaller sequence diagrams that capture the essence of the use case
• Instead of cluttering your sequence diagram with several objects and groups of
messages that will confuse the reader, draw a few smaller sequence diagrams
that aptly explain what your system does
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
• Remember that actors can only communicate with interface objects such as
screens, menus and icon bars

: icon bar

: user
click send mail
The icon bar has some work to do
• It creates an email page
• Now the user can see the email page and use it

: icon bar : email page

: user
click send mail create
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
: icon bar : email page : address book : email server

: user
send mail( ) create( )

enterTo( )
enterSubject( )
enterContents( )

send( )
getEmailAddress( )

submitEmail( )

close( )
• 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()
Use Case
• Use case ID: UC-1
• Use case Name: Validate PIN
• Goal: The system validates the customer PIN
• Actor(s): ATM Customer
• Precondition:
• ATM is idle
• Displaying a welcome message
• Post condition: Customer PIN has been validated
Flow of Events
• 1.Customer inserts the ATM card into the Card Reader
• 2.If the system recognizes the card, it reads the card number
• 3.System prompt customer for PIN number
• 4.Customer enters PIN
• 5.System checks the expiration date and whether the card is lost or stolen
• 6.If card is valid, the system then checks whether the user-entered PIN
matches the card PIN maintained by the system
• 7.If PIN numbers match, the system checks what accounts are accessible with
the ATM card
• 8.System displays customer accounts and prompts customer for transaction
type: Withdrawal, Query, or Transfer
Alternate Flow
• 2(a). If the system does not recognize the card the card is ejected
• 5(a). If the system determines that the card date has expired the card is
confiscated
• 5(b). If the system determines that the card has been reported lost or stolen,
the card is confiscated
• 7(a)-1. If the customer-entered PIN does not match the PIN number for this
card, the system re-prompts for PIN
• 7(a)-2. If the customer enter the incorrect PIN three times, the system
confiscates the card
• 3(a)/4(a)/6(a)/8(a). If the customer enters Cancel, the system cancels the
transaction and ejects the card
Sequence Diagram
• Identify the entities
• 1.Customer inserts the ATM card into the Card Reader
• 2.If the system recognizes the card, it reads the card number
• 3.System prompt customer for PIN number
• 4.Customer enters PIN
• 5.System checks the expiration date and whether the card is lost or
stolen
• 6.If card is valid, the system then checks whether the user-entered
PIN matches the card PIN maintained by the system
• 7.If PIN numbers match, the system checks what accounts are
accessible with the ATM card
• 8.System displays customer accounts and prompts customer for
transaction type: Withdrawal, Query, or Transfer

You might also like