umlsequence-diagram

UML Sequence diagram - which side owns the message method being invoked?


According to the UML standards, when using Sequence diagrams, is it strictly defined who has perform() operation specified in this message below?

Foo interacts with Bar, "passing a message"

Sequence diagram

(there is a typo in the diagram it should say perform() )

The possible combinations that I would like to know which ones are valid (say in the accompanying class diagram)

A. Foo has it and Bar can't have it:

enter image description here

B. Bar has it and Foo can't have it:

enter image description here

C. Possibly both coud have it:

enter image description here

I can't find the concrete definition in UML spec, and wondering also what authoritative resources (Fowler, Jacobson, Booch, Rumbaugh) say about it.


Solution

  • The thing at the pointy end of the arrow (in this case, a Bar) must offer an operation for the thing at the blunt end of the arrow (in this case, a Foo) to be able to call it. So, option B is required.

    There is nothing preventing both sides from offering the same operation, though. So, option C is also possible.

    Note that there’s a typo in your sequence diagram.