3.4.9 Representing Base-Class Calls in Sequence Diagrams

Representing Base-Class Calls in Sequence Diagrams

An override can explicitly ask its base implementation to do part of the work. The diagram should show that nested execution without inventing another object.

Read the Code Before Drawing

These are complete definitions of the same Player and Goalkeeper training behavior. Consider a Controller call casey.RecordTurn() with both counts initially zero.

Source to translate
public class Player
{
    public int NumberOfTurns;

    public virtual void RecordTurn()
    {
        NumberOfTurns = NumberOfTurns + 1;
    }
}

public class Goalkeeper : Player
{
    public int SavesPracticed;

    public override void RecordTurn()
    {
        base.RecordTurn();
        SavesPracticed = SavesPracticed + 1;
    }
}
Rewrite the Meaning in Ordinary Words
Pseudocode for the same behavior
The controller calls RecordTurn on Casey the Goalkeeper
The override begins on that Goalkeeper instance
It explicitly executes the Player implementation through base.RecordTurn
The base body increases NumberOfTurns
The override then increases SavesPracticed
The original call completes

Use these words to follow one execution before drawing it. Keep the same order and the same alternatives as the source; simplify the wording without adding work that the code does not perform.

Map the Source to Lifelines and Messages
Build the Diagram in Violet
  1. Create a Violet sequence diagram with controller : Controller and casey : Goalkeeper.
  2. Draw the external request RecordTurn() to casey and start the override activation.
  3. From that activation draw a self-call on the same lifeline labeled base.RecordTurn() [Player body]. Add a nested activation for the base body.
  4. Note NumberOfTurns increases by 1, then end the nested activation with a dashed self-return. Below it note SavesPracticed increases by 1 as the remaining override work.
  5. Return to the original caller only after that remaining work. Save and check that both bodies are represented on one casey lifeline.
Compare the Completed Soccer Diagram

Compare this reference with the diagram you built in Violet. Layout may differ; the source meaning, labels, and relevant connections should agree.

Casey handles the override, executes Player RecordTurn through a self-call, then performs the goalkeeper-specific update.
A nested base call executes on the same receiver
  • New
  • Changed
  • Removed
Trace One Interaction from Top to Bottom

The nested activation ends first. With initial counts zero, the base body makes NumberOfTurns 1 and the remaining override makes SavesPracticed 1.

Verify the Drawing Against the Source
Predict and Check a Small Change