Professional Documents
Culture Documents
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).
Systems
Model
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
: 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
: 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
: 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