1.3.7 Method Calls in Sequence Diagrams

A Message Can Represent a Method Call

Suppose the C# source contains:

C#
team1.DisplayName();

A sequence diagram can represent that call as a message sent to team1.

Conceptually:

Plain text
caller ── DisplayName() ──> team1

The arrow shows the direction of the call.

The label names the method being called.

The Receiver Matters

For:

C#
team1.DisplayName();

the receiver is:

Plain text
team1

For:

C#
player1.ShowStatus();

the receiver is:

Plain text
player1

The sequence diagram should send the message to the object whose method executes.

Message Names Should Match the Code

If the method is:

Plain text
DisplayName()

do not label the diagram message:

Plain text
ShowTeam()

unless the source and model actually use that name.

Consistency helps you trace UML to code.

Order Matters

If code performs:

C#
team1.ResetScore();
team1.DisplayName();

the first message belongs above the second message in the sequence diagram.

The diagram models execution order.

Current Calls Use Empty Parentheses

Method parameters are taught later.

At this boundary, a simple message such as:

Plain text
DisplayName()

is enough to represent a parameterless method call.

A Sequence Diagram Is Not a Flowchart

The lifelines represent participants.

The messages represent communication between them.

Do not replace each method call with an activity-diagram action box.

Choose notation that matches the interaction question.