Detailed Table of Contents
Guidance for the item(s) below:
As with the class/object diagrams, let us refresh our memory of the sequence diagrams notations that you learned in TIC2002.
Can draw basic sequence diagrams
UML Sequence Diagrams → Introduction UML/SequenceDiagrams
UML Sequence Diagrams → Basic Notation UML/SD/Basic
UML Sequence Diagrams → Loops UML/SD/Loops UML Sequence Diagrams → Object Creation UML/SD/Creation
UML Sequence Diagrams → Minimal Notation UML/SD/Minimal
Exercises
Explain Sequence Diagram about Machine
Explain in your own words the interactions illustrated by this Sequence Diagram:

Draw a Sequence Diagram for the code (PersonList, Person, Tag)
Consider the code below:
class Person {
Tag tag;
String name;
Person(String personName, String tagName) {
name = personName;
tag = new Tag(tagName);
}
}
class Tag {
Tag(String value) {
// ...
}
}
class PersonList {
void addPerson(Person p) {
// ...
}
}
Draw a sequence diagram to illustrate the object interactions that happen in the code snippet below:
PersonList personList = new PersonList();
while (hasRoom) {
Person p = new Person("Adam", "friend");
personList.addPerson(p);
}
Find notation errors in Sequence Diagram
Find notation mistakes in the sequence diagram below:

Follow up notes for the item(s) above:
Now that you know the basic notations for the sequence diagrams, here is a worked example of drawing sequence diagrams (basic notation) to match a code snippet.
Item creation
Guidance for the item(s) below:
Earlier, you learned the basic syntax used in sequence diagrams. Now, let's learn some intermediate syntax.
Can draw intermediate-level sequence diagrams
UML Sequence Diagrams → Object Deletion UML/SD/Deletion UML Sequence Diagrams → Self-Invocation UML/SD/Self-Invocation UML Sequence Diagrams → Alternative Paths UML/SD/Alternative UML Sequence Diagrams → Optional Paths UML/SD/Optional
UML Sequence Diagrams → Calls to Static Methods
UML/SD/StaticMethods
Method calls to static (i.e., class-level) methods are received by the class itself, not an instance of that class. You can use <<class>> to show that a participant is the class itself.
In this example, m calls the static method Person.getMaxAge() and also the setAge() method of a Person object p.
Here is the Person class, for reference:
Exercises
What’s going on here?
What’s going on here?
Logic object is executing a parallel thread.Logic object is executing a loop.Logic object is creating another Logic instance.Logic object’s methods is calling another of its methods.Minefield object is calling a method of Logic.(d)
Explain Sequence Diagram (ParserFactory)
Explain the interactions depicted in this sequence diagram.
First, the createParser() method of an existing ParserFactory object is called. Then, ...
Draw Sequence Diagram for printing a quote
Draw a sequence diagram to represent this code snippet.
if (isFirstPage) {
new Quote().print();
}
The Quote class:
class Quote {
String q;
Quote() {
q = generate();
}
String generate() {
// ...
}
void print() {
System.out.println(q);
}
}
new Quote().print(); as two method calls.print() method is called.
Can interpret sequence diagrams with parallel paths
UML uses par frames to indicate parallel paths.
Notation:
Logic is calling methods CloudServer#poll() and LocalServer#poll() in parallel.
If you show parallel paths in a sequence diagram, the corresponding Java implementation is likely to be multi-threaded because a normal Java program cannot do multiple things at the same time.
Can interpret sequence diagrams with reference frames
UML uses ref frame to allow a segment of the interaction to be omitted and shown as a separate sequence diagram. Reference frames help you to break complicated sequence diagrams into multiple parts or simply to omit details you are not interested in showing.
Notation:
The details of the get minefield appearance interactions have been omitted from the diagram.
Those details are shown in a separate sequence diagram given below.

Follow up notes for the item(s) above:
Here is a worked example of drawing sequence diagrams (intermediate notation) to match a code snippet.
TaskList#generateTask()Quote