This site is from a past semester! The current version will be here when the new semester starts.
TIC4001 2020
  • Full Timeline
  • Week 1 [Mon, Aug 10th]
  • Week 2 [Fri, Aug 14th]
  • Week 3 [Fri, Aug 21st]
  • Week 4 [Fri, Aug 28th]
  • Week 5 [Fri, Sep 4th]
  • Week 6 [Fri, Sep 11th]
  • Week 7 [Fri, Sep 18th]
  • Week 8 [Fri, Oct 2nd]
  • Week 9 [Fri, Oct 9th]
  • Week 10 [Fri, Oct 16th]
  • Week 11 [Fri, Oct 23rd]
  • Week 12 [Fri, Oct 30th]
  • Week 13 [Fri, Nov 6th]
  • Textbook
  • Admin Info
  • Report Bugs
  • Forum
  • Gitter (Chat)
  • Instructors
  • Announcements
  • Files
  • Java Coding Standard
  • Git Conventions
  • Participation Dashboard

  •  Individual Project (iP):
  • Individual Project Info
  • iP List
  • iP Upstream Repo
  • iP Code Dashboard
  • iP Progress Dashboard

  •  Team Project (tP):
  • Team Project Info
  • Team List
  • tP Code Dashboard
  • tP Progress Dashboard
  • Week 12 [Fri, Oct 30th] - Topics

    • [W12.1] Sequence Diagrams: Basics
    • [W12.1a] Design → Modelling → Modelling Behaviors Sequence diagrams - basic :
    • [W12.2] Sequence Diagrams: Intermediate
    • [W12.2a] Design → Modelling → Modelling Behaviors Sequence diagrams - intermediate :

    • [W12.2b] Tools → UML → Sequence Diagrams → Parallel paths :

    • [W12.2c] Tools → UML → Sequence Diagrams → Reference frames :


    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.

    [W12.1] Sequence Diagrams: Basics

    W12.1a :

    Design → Modelling → Modelling Behaviors Sequence diagrams - basic

    Video

    Can draw basic sequence diagrams

    Explain in your own words the interactions illustrated by this Sequence Diagram:

    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 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.

    Video Sequence diagrams (basic) - 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.

    [W12.2] Sequence Diagrams: Intermediate

    W12.2a :

    Design → Modelling → Modelling Behaviors Sequence diagrams - intermediate

    Video

    Can draw intermediate-level sequence diagrams

    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:

    What’s going on here?

    • a. Logic object is executing a parallel thread.
    • b. Logic object is executing a loop.
    • c. Logic object is creating another Logic instance.
    • d. One of Logic object’s methods is calling another of its methods.
    • e. Minefield object is calling a method of Logic.

    (d)

    Explain the interactions depicted in this sequence diagram.

    First, the createParser() method of an existing ParserFactory object is called. Then, ...

    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);
    }

    }
    • Show new Quote().print(); as two method calls.
    • As the created Quote object is not assigned to a variable, it can be considered as 'deleted' soon after its print() method is called.

    W12.2b :

    Tools → UML → Sequence Diagrams → Parallel paths

    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.

    W12.2c :

    Tools → UML → Sequence Diagrams → Reference frames

    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.

    Video Drawing sequence diagrams (intermediate) - TaskList#generateTask()

    Video Drawing sequence diagrams (intermediate) - create Quote