Topic 8: Analysis and Design II: Robustness and Sequence Diagrams

Robustness Diagrams

Bridging the gap between the User and the Code

We have already seen that the domain model represents classes in the system, while use-cases analyse the application from a user interaction point of view. However, we need to bridge the gap between these two aspects of the system, the user interaction, and the potential classes. Robustness diagrams allow us to do this by considering what classes from the domain model are needed for each step of each use-case. See Rosenberg and Stephens, "Use Case Driven Object Modeling with UML - Theory and Practice" (2013), p101-2

Robustness Diagram Notation

Robustness diagrams use three different symbols to represent different aspects of the system:
Robustness Diagram Notation

Robustness Diagram Rules

Robustness diagrams must follow certain interaction rules, described below:

How to Create a Robustness Diagram

Example: Enrol student

We will now look at a robustness diagram for the "enrol student" use case. The use-case text is repeated below, from week 4.

Step Actor action System response
1 The use case begins when the admin staff selects to enrol a new student. -
2 - System prompts the user for the student details (name, address, date of birth, course)
3 The user enters the details specified in step 2. -
4 - System checks validity of details, e.g. date of birth is sensible
5 - System allocates student ID for new student
6 - System enrols student in university
7 - System confirms enrolment is successful

The robustness diagram for Enrol student

Robustness Diagram: Enrol student

The diagram is derived from the use-case text as follows:

Example: Edit student details

Here is a second example, again the use-case text is repeated from week 4.

Step Actor action System response
1 The use case begins when the admin staff selects to edit the student details -
2 - System prompts the user for the student ID
3 The member of staff enters the student ID. -
4 - System searches for the student with that ID
5 - System displays details of that student in editable text boxes
6 The admin staff changes the details. -
7 - System checks that the new details are valid (e.g. no blank strings)
8 - System updates details of the student
10 - System confirms details updated

The Robustness Diagram

Robustness Diagram: Edit student

Discovering new entity objects


Sequence diagrams

Having linked the use-cases to the domain model classes with robustness diagrams, the next stage is to move to a more detailed design, in which we work out what methods might be in the system, which classes they belong to and what order each method should be called. The sequence diagram allows us to do this: sequence diagrams show all the components in the system and their interactions (in the form of method calls), focusing on the order (sequence) in which they are called. Once a sequence diagram is completed, the methods shown on it can be used to enhance or correct the class diagram, to produce a finalised, accurate class diagram from which coding can begin.

How to draw a sequence diagram

Notation

Example 1 - Enrol student

Enrol student - sequence diagram

Example 2 - Edit student details

Search for member sequence diagram

Alternative courses of action on a sequence diagram

You can also show alternative courses of action on a sequence diagram. This sis done by means of a UML frame. This has a label (alt for alternative courses of action) together with two or more sections, each representing an alternative course of action, and separated by a dotted line. Each section is annotated with the condition which must hold true for that course of action to run. Here is an example:
Sequence diagram showing alternative courses of action

Preparing a sequence diagram in diagrams.net

Please see this blog article for more detail on preparing a sequence diagram in diagrams.net.

Exercise

Note: exercises on use cases have now been moved here from week 4.

Use cases

For the live music venue scenario from week 4, draw up a use case diagram for these use cases:

Ideally use extends and precedes as appropriate.

Robustness and Sequence diagrams

Below is a domain model and two use case texts for the live music venue scenario, introduced in week 4. Using these:

  1. Prepare a robustness diagram for "add an event".
  2. Prepare a sequence diagram for "add an event".
  3. Prepare a robustness diagram for "book an event".
  4. Prepare a sequence diagram for "book an event".

Domain model

Week 4 class diagram solution

Use-case text: Add an event (easy)

Step Actor action System response
1 The use case begins when an administrator selects to add an event -
2 - System prompts the administrator for the event details
3 The administrator enters the event details -
4 - System checks there is no event already on that date at that time
5 - System creates event with the entered details
6 - System adds the event to the venue.
7 - System confirms event added to the user.

Use-case text: Book an event (harder)

Step Actor action System response
1 The use case begins when a customer selects to book an event -
2 - System prompts the customer for the event name
3 The customer enters the event name. -
4 - System searches for the event(s) with that name
5 - System displays details of all matching events
6 The customer chooses an event from the list. -
7 - System checks the event is not fully booked
8 - System books the event for the customer
9 - System confirms event booked