In UML sequence diagrams, given two objects A and B, if Object A
sends a message
to Object B
. Does this mean the message
is a method in Object B
which is invoked from Object A
?
2 Answers 2
UML diagrams are an abstraction. What a message is exactly can be different depending on what concrete entities your diagram shows. The lifelines are not necessarily objects, and the diagram might also be at a higher level of abstraction where a message represents something more complex.
Another factor is that the original concept of "object oriented programming" actually used the concept of messages, not methods - methods are merely a limited (but efficient) way to implement message handlers.
So if the lifelines in your diagrams represent objects in a language that uses only methods to implement message handles, and if the person who draws the program wants it to show low-level concepts then your UML messages will represent method calls.
Sending a message from Object A to Object B is any form of communication initiated by Object A. One of possible forms is calling a method of Object B. But it can be also a signal captured by Object B or even something more complex/totally different. Since UML is not restricted to programming only it can even be one person (Object A) telling something the other person (Object B).