'Who owns the method in a sequence diagram?
Say we have the 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?
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |