Sequence Diagrams in Software Development

Sequence Diagrams
Introduction
A Sequence diagram depicts the 
sequence of
actions that occur in a system.
The 
invocation of methods 
in each 
object
, and the
order 
in which the 
invocation
 occurs is captured in
a Sequence diagram.
This makes the 
Sequence diagram 
a very useful
tool to easily represent the 
dynamic behavior of a
system.
A Sequence diagram is 
two-dimensional
 in nature.
On the 
horizontal axis
, it shows the 
life of the
object 
that it represents, while on the 
vertical axis
,
it shows the 
sequence of the creation 
or
invocation of these objects.
Message Arrows
 for Communications
The 
message
 arrows represent the 
communications between
two objects
 in a sequence diagram. It goes from the 
lifeline of
one object
 to 
that of another object
Synchronous
 
message
 where the sending object suspends action and
waits for the response to the message
Asynchronous
 
message
 where the sending object continues with its
operations without waiting for the response
A 
return of control
 from the 
synchronous message
A 
creation
 
of a new entity
(filled head)
(open head)
OOAD
11
Example 1: Withdraw saving
Scenario:
1.
He enters his card into an ATM (automated teller machine).
2.
The ATM machine prompts “ Enter PIN”.
3.
The customer enters his PIN.
4.
The ATM (internally) retrieves the bank account number from the
card.
5.
The ATM encrypts the PIN and the account number and sends it
over to the bank.
6.
The bank verifies the encrypted account and PIN number.
7.
If the PIN number is correct, the ATM displays, “Enter Amount”.
8.
Draws money from the bank account and pays out the amount.
12
Withdraw saving
Use Case: 
 
Withdraw Saving
Actors:
  
Bank, Client
Flow of Events:
1.
Bank client insert ATM card into ATM machine
2.
ATM machine request PIN code
3.
Bank client enter PIN code
4.
Verify PIN code entered with saving account
5.
ATM machine request amount if the PIN is valid
6.
Bank client enter the required amount
7.
Process the transaction in the client account
8.
ATM machine dispense cash
9.
ATM machine print receipt when the transaction completed
Alternative Flow of Events
Invalid PIN code entered. Indicate error message. Return step 3. 
OOAD
13
Identifying Classes
Bank Client
ATM Card
ATM Machine
Savings Account
Cash
Message
Example 2: Buying Tickets
An interaction between a customer, ticket seller, database and printer.
Example 3: Logging in
Let's start with the simple example above: a user logging onto the
system.  The 
Logon
 use case can be specified by the following step:
1. Logon dialog is shown
2. User enters user name and password
3. User clicks on OK or presses the enter key
4. The user name and password are checked and approved
5. The user is allowed into the system
   Alternative: Logon Failed - if at step 4 the user name and password are not
approved, allow the user to try again
Example 4: 
Course Enrolment System
 
Example 5: 
Product Order
Example 6: 
Search Engine
QUESTIONS
Slide Note
Embed
Share

Sequence diagrams depict the sequence of actions in a system, capturing the invocation of methods in objects. They are a valuable tool for representing dynamic system behavior. Message arrows in sequence diagrams indicate communications between objects, illustrating synchronous and asynchronous message interactions. An example scenario of a withdrawal process at an ATM demonstrates the use of sequence diagrams in real-life applications.

  • Software Development
  • Sequence Diagrams
  • Dynamic Behavior
  • Communication
  • ATM

Uploaded on Oct 06, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. Sequence Diagrams

  2. Introduction A Sequence diagram depicts the sequence of actions that occur in a system. The invocation of methods in each object, and the order in which the invocation occurs is captured in a Sequence diagram. This makes the Sequence diagram a very useful tool to easily represent the dynamic behavior of a system. A Sequence diagram is two-dimensional in nature. On the horizontal axis, it shows the life of the object that it represents, while on the vertical axis, it shows the sequence of the creation or invocation of these objects.

  3. Message Arrows for Communications The message arrows represent the communications between two objects in a sequence diagram. It goes from the lifeline of one object to that of another object Synchronous message where the sending object suspends action and waits for the response to the message (filled head) Asynchronous message where the sending object continues with its operations without waiting for the response (open head) A return of control from the synchronous message A creation of a new entity

  4. Example 1: Withdraw saving Scenario: 1. He enters his card into an ATM (automated teller machine). 2. The ATM machine prompts Enter PIN . 3. The customer enters his PIN. 4. The ATM (internally) retrieves the bank account number from the card. 5. The ATM encrypts the PIN and the account number and sends it over to the bank. 6. The bank verifies the encrypted account and PIN number. 7. If the PIN number is correct, the ATM displays, Enter Amount . 8. Draws money from the bank account and pays out the amount. OOAD 11

  5. Withdraw saving Use Case: Actors: Withdraw Saving Bank, Client Flow of Events: 1. Bank client insert ATM card into ATM machine 2. ATM machine request PIN code 3. Bank client enter PIN code 4. Verify PIN code entered with saving account 5. ATM machine request amount if the PIN is valid 6. Bank client enter the required amount 7. Process the transaction in the client account 8. ATM machine dispense cash 9. ATM machine print receipt when the transaction completed Alternative Flow of Events Invalid PIN code entered. Indicate error message. Return step 3. 12

  6. Identifying Classes Bank Client ATM Card ATM Machine Savings Account Cash Message OOAD 13

  7. ATM-Machine SavingAccount Client Insert ATM card Request PIN Enter PIN code Verify PIN code PIN valid Request amount Enter amount Process transaction Transaction successful Dispense cash Print receipt

  8. Example 2: Buying Tickets An interaction between a customer, ticket seller, database and printer.

  9. Example 3: Logging in Let's start with the simple example above: a user logging onto the system. The Logon use case can be specified by the following step: 1. Logon dialog is shown 2. User enters user name and password 3. User clicks on OK or presses the enter key 4. The user name and password are checked and approved 5. The user is allowed into the system Alternative: Logon Failed - if at step 4 the user name and password are not approved, allow the user to try again

  10. Example 4: Course Enrolment System

  11. Example 5: Product Order

  12. Example 6: Search Engine

  13. QUESTIONS

More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#