Experiment 8 (Sequence Diagram)
Objective: To have a better understanding of interaction diagram specifically sequence diagram
and to practice drawing sequence diagram using Violet UML Editor.
Estimated Time: 25 minutes
Background
       Interaction diagrams describe how groups of objects collaborate in some behavior.
An interaction diagram typically captures the behavior of a single use case. Interaction
diagrams do not capture the complete behavior, only typical scenarios. UML offers two
diagrams to model the dynamics of the system: sequence and collaboration diagrams. These
diagrams show the interactions between objects. In this lab you will practice how to create
sequence diagram using Star UML.
Sequence Diagram
Sequence diagrams are a graphical way to illustrate a scenario:
       They are called sequence diagrams because they show the sequence of message passing
        between objects.
       Another big advantage of these diagrams is that they show when the objects are created
        and when they are destroyed. They also show whether messages are synchronous or
        asynchronous.
Sequence Diagram Applications
Sequence diagrams can be useful reference diagrams for businesses and other organizations. Try
drawing a sequence diagram to:
    Represent the details of a UML use case.
    Model the logic of a sophisticated procedure, function, or operation.
    See how tasks are moved between objects or components of a process.
    Plan and understand the detailed functionality of an existing or future scenario.
Sequence Diagram Components
To understand what a sequence diagram is, you should be familiar with its components. Sequence
diagrams are made up of the following elements:
UML Sequence Message Symbols
       Packets of information that are transmitted between objects. They may reflect the start
and execution of an operation, or the sending and reception of a signal.
Sequence Diagram Uses
       Usage Scenario - A usage scenario is a diagram of how your system could potentially be
        used. It's a great way to make sure that you have worked through the logic of every usage
        scenario for the system.
       Method Logic - Just as you might use a UML sequence diagram to explore the logic of a
        use case, you can use it to explore the logic of any function, procedure, or complex
        process.
       Service Logic - If you consider a service to be a high-level method used by different
        clients, a sequence diagram is an ideal way to map that out.
Creating Sequence Diagrams
       You must know the scenario you want to model before diagramming sequence diagrams.
       After that specify the classes involved in that scenario.
       List the involved objects in the scenario horizontally on the top of the page.
       Drop a dotted line beneath every object. They are called lifelines.
       The scenario should start by a message pass from the first object.
       You must know how to place the objects so that the sequence is clear.
       You may start the scenario by an actor.
       Timing is represented vertically downward.
       Arrows between life lines represents message passing.
       Horizontal arrows may pass through the lifeline of another object, but must stop at some
        other object.
       You may add constraints to these horizontal arrows.
       Objects may send messages to themselves.
       Long, narrow rectangles can be placed over the lifeline of objects to show when the
        object is active. These rectangles are called activation lines.
Notes
       Always keep your diagrams simple.
       For “IF... then ...” else scenarios, you may draw separate sequence diagrams for the
        different branches of the “if statement”. You may even hide them, (at least during the
        analysis phase) and document them by the text description accompanying the sequence
        diagrams.
Example of Sequence Diagram Template
Example of Sequence Diagram
Lab Tasks
Total Points: 10
Estimated Time: 50 minutes
Draw sequence diagram for an ATM Machine system. Below are descriptions about the use cases for this
system.
Actors involved:
• Operator
• Customer
• Bank
Following are the names and brief description of each use case of the ATM system
• Session Use Case
A session is started when a customer inserts an ATM card into the card reader slot of the machine. The
ATM pulls the card into the machine and reads it. (If the reader cannot read the card due to improper
insertion or a damaged stripe, the card is ejected, an error screen is displayed, and the session is aborted.)
The customer is asked to enter his/her PIN, and is then allowed to perform one or more transactions,
choosing from a menu of possible types of transaction in each case. After each transaction, the customer is
asked whether he/she would like to perform another. When the customer is through performing
transactions, the card is ejected from the machine and the session ends. If a transaction is aborted due to too
many invalid PIN entries, the session is also aborted, with the card being retained in the machine.
• Transaction Use Case
Note: the session use case includes transaction use case.
A transaction use case is started within a session when the customer chooses a transaction type from a
menu of options. The customer will be asked to furnish appropriate details (e.g. account(s) involved,
amount). The transaction will then be sent to the bank, along with information from the customer's card and
the PIN the customer entered.
If the bank approves the transaction, any steps needed to complete the transaction (e.g. dispensing cash or
accepting an envelope) will be performed, and then a receipt will be printed. Then the customer will be
asked whether he/she wishes to do another transaction.
If the bank reports that the customer's PIN is invalid, the Invalid PIN extension will be performed and then
an attempt will be made to continue the transaction. If the customer's card is retained due to too many
invalid PINs, the transaction will be aborted, and the customer will not be offered the option of doing
another.
Following use cases are used by transaction use case:
• Transfer Transaction Use Case
• Deposit Transaction Use Case
• Invalid PIN Extension
Deliverables
Take a screenshot of your diagrams and compile it in a single word document the upload it in the
assignment section for Lab 08 in Blackboard.com