Are there any rules, if methods written on arrows in uml sequence diagram (related to say java code) are the methods of the object, where the arrow comes from or where it goes to? Does this depend on the sort of arrow or its directions or are there no exact rules for that at all? Thanks a lot.
-
1it's supposed to be a method from the target object. – Geert Bellekens Sep 01 '21 at 13:39
-
People seem to follow this rule not very strictly. Thank you! – MagisterInformaticus Sep 01 '21 at 14:31
-
What people do is not always right, is it? – qwerty_so Sep 02 '21 at 08:05
-
@MagisterInformaticus, please mark the answer that helped you most as 'accepted'. This gives credit points to the one who gave that answer. – www.admiraalit.nl Sep 07 '21 at 08:06
2 Answers
Yes, there are rules. You specifically ask about "methods written on arrows", so I will stick to "methods" (called "operations" in UML terms), although it is also possible to mention signals.
For methods, there are two arrow types:
- Request arrow: An arrow from caller to callee, with a solid line and a filled arrowhead (or an open arrowhead if it is an asynchronous call).
- Reply arrow: An arrow from callee to caller, at the point where the method returns, with a dashed line and an open arrowhead.
In case of a request arrow, the label of the arrow shows the name of one of the methods of the target of the arrow. In case of a reply arrow, the label shows one of the methods of the source of the arrow.
You may choose to only draw request arrows and forget about reply arrows.
The syntax of the labels of these arrows is specified in section 17.4.4 of the UML specification.
The label of a request arrow has the following syntax:
The message-name is the name of the method that is called. Example:
If you wish, you may omit the parameters and just write requestUniqueId
.
The label of a reply arrow has the following syntax:
The message-name is the name of the method that just ended. Example:
You may also draw reply arrows without labels, if you don't want to show the returned values in your diagram.

- 5,768
- 1
- 17
- 32
In short
Yes the object's "method" on the arrow refers to the target's "method".
Some more explanations
The arrows in a sequence diagram represent messages.
A message is either an operation or a signal. And depending on what it is, it must be the name of either an operation or a signal:
an operation is in UML jargon what many programming languages call a method. The message semantics are in this case:
If the messageSort is either synchCall or asynchCall, then the Message represents the synchronous or asynchronous call to and start of execution of the Operation.
If the messageSort is reply, then the Message represents the return from a synchronous call to the Operation.So it is the sender that calls an operation of the target.
a signal:
is a specification of a kind of communication between objects in which a reaction is asynchronously triggered in the receiver without a reply.
Signals are a special beast that would require a lot more explanations that are not relevant for your questions. I mention it only to say that it is not necessarily only about "methods". But the semantics are likewise: the receiver at the end of the arrow needs to process it.
Edit: Reply messages (dashed arrows that do not create an object) return to the caller and have a slightly different rule. Very often, they are left without any label as their identity is obvious, or they do not match an operation signature and just indicate a result. However, if they indicate an operation name, it should be the name of the message that initiated the "call" (which means, in this special case, the name of the operation that was called on the source and returns). Thanks @www.admiraalit.nl to highlight the need to explain my shortcut.

- 68,716
- 7
- 72
- 138
-
Since the question is "are there any rules?" the answer should simply be: yes, in the UML 2.5 specs. Of course followed by your explanation ;-) – qwerty_so Sep 02 '21 at 21:11
-
@qwerty_so indeed. And I must confess that I'm always tempted to just answer "yes" whenever someone asks me "do you know what time it is?" ;-) – Christophe Sep 02 '21 at 21:18
-
-
Your answer is not correct in case of a reply message, because in that case, the arrow shows the name of the method of the source of the arrow, not the target. – www.admiraalit.nl Sep 03 '21 at 14:51
-
@www.admiraalit.nl That's a fair remark: if the reply message has a signature it is the name of the operation that was called (i.e. the name of an operation of the object that sends the return message). On the other side, very often in practice the reply messages don't have a name at all because it's obvious (last paragraph of UML specs section 17.4.41), or is unconstrained as it has no signature (the return value being often indicated). I'll complete the answer an UV yours. – Christophe Sep 03 '21 at 15:52