3.6.16 Representing Interface Implementation Connectors in Class Diagrams

Representing Interface Implementation Connectors in Class Diagrams

A connector must distinguish implementing an interface from inheriting a concrete class or merely referring to an object.

Read the Code Before Drawing

This is the same minimal ITrainable contract and Player implementation. The source colon introduces interface implementation here because ITrainable is declared as an interface.

Source to translate
public interface ITrainable
{
    void RecordTurn();
}

public class Player : ITrainable
{
    public int NumberOfTurns;

    public void RecordTurn()
    {
        NumberOfTurns = NumberOfTurns + 1;
    }
}
Rewrite the Meaning in Ordinary Words
The same design in ordinary words
Define the ITrainable contract requiring RecordTurn
Define Player with its own turn-count field and public implementation
State that Player implements ITrainable
Connect the implementation to the contract
Do not introduce a stored interface field

These words describe the class contract, not a sequence of runtime actions. Identify the types, stored members, operation inputs and results, and relationships before choosing compartments and connectors.

Map the Source to Class Boxes and Connectors
Build the Diagram in Violet
  1. Create a Violet class diagram with Player and an interface box named ITrainable visibly marked <<interface>>. If using an ordinary class-shaped box, retain the stereotype.
  2. Enter +RecordTurn() : void in the interface operation compartment. In Player add +NumberOfTurns : int and its public +RecordTurn() : void operation.
  3. Connect Player toward ITrainable with interface realization: a dashed line ending in a hollow triangle at ITrainable.
  4. Add a short line label or nearby note realizes. Check that the connector is not a solid inheritance line or a plain reference arrow.
  5. Save and read the connector aloud: Player fulfills ITrainable. The direction should lead from implementation to contract.
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.

Player realizes ITrainable with a dashed hollow-triangle connector pointing at the interface contract.
The realization arrow points to the interface
  • New
  • Changed
  • Removed
Read the Contract One Part at a Time

Read the connector as Player fulfills ITrainable. It does not mean an interface object is stored inside every Player or that a message is being sent.

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