Albus Dumbledore
Albus Dumbledore

Reputation: 12616

Who owns the method in a sequence diagram?

Say we have the diagram:

Sample sequence diagram

I wonder whether it's known by the diagram who owns the methods.

For instance: Is pickup a method of Waiter? Is serve food then a method of Patron?

More generally, do the arrows show the owners of the methods?

Upvotes: 1

Views: 620

Answers (1)

user684934
user684934

Reputation:

This is a counterintuitive (ie bad) choice of method names.

Fred is ordering the food, that's right. He's ordering the food by calling takeOrder(), which belongs to the waiter. Imagine Frank tries to call order food on anyone other than a waiter. It wouldn't work, because they're not waiters, and they don't have takeOrder().

The methods belong to the objects that are being called.

Upvotes: 4

Related Questions