Lab 3
Lab 3
Lab 03
Student Information
Student Name
Student ID
Date
Assessment
Marks Obtained
Remarks
Signature
Usman Institute of Technology
Department of Computer Science
SE308 - Software Design and Architecture
Lab 03
Sequence Diagram
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.
Sequence diagrams can be used to drive out testable user interface requirements.
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.
Actor
An Actor is modeled using the ubiquitous symbol, the stick figure.
Messages Arrow
An arrow from the Message Caller to the Message Receiver specifies a message in a
sequence diagram. A message can flow in any direction; from left to right, right to left, or
back to the Message Caller itself
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
Create a new sequence diagram called Add a Course Offering for the Select Courses to Teach
From To Message
Professor course options form add a course
course options form add course form display
Professor add course form select course offering
add course form course add professor (prof id)
course course get professor (prof id)
course course offering add professor (professor)
Branching and Looping in Sequence Diagram
When a student wants to register for an exam, the following cases can occur:
(1) There are still places available and the student can register.
(2) There is a place available on the waiting list. Then the student has to decide whether to
go on the waiting list.
(3) If there is no place available for the exam or on the waiting list for the exam, the student
receives an error message and is not registered for the course.
This would be specified as an if statement without an else branch. Figure illustrates the use of the
opt fragment. If there is a place available on the waiting list, when registering for an assignment
the student can decide whether to take the place on the waiting list. If the student wants to be on
the waiting list, the student has to register for it.
Example of Loop and Break in sequence diagram
System login that is necessary before a student can register for an assignment. The password must
be entered at least once and at most three times, as reflected by the arguments of loop. After the
first attempt, the system checks whether the password can be validated. If it can, that is, the condition
Password incorrect is no longer true, execution of the interactions within the loop ceases. The system
also exits the loop if the student enters the password incorrectly three times. This case is then
handled further in the subsequent break fragment.
The break operator thus offers a simple form of exception handling. For our example in Figure
above, this means that if the password is entered incorrectly three times, the condition incorrect
password is true. Thus the content of the break fragment is executed, meaning that an error
message is sent to the student and the student is not allowed to register for the assignment. The
remainder of the interaction after the end of the break fragment is skipped. After exiting the break
operator, we are in the outermost fragment of the sequence diagram and therefore the execution of
this sequence diagram is ended. If we were not in the outermost fragment, the sequence diagram
would continue in the fragment at the next higher level.
Student Tasks
Create Sequence diagram for the following system