1

EXAMPLE DIAGRAM

Hi,

I am not very experienced in UML, so this is probably a very simple question. How can I depict a method call to a different class from a member method call? Or am I supposed to show this?

For example, class Foo has a "FooMethod". Class Bar has a "BarMethod". Foo calls FooMethod, which calls BarMethod before returning.

To show this, I draw a self method call in Foo's lifeline. Then I draw a method call to Bar in the gap between Foo's self call's start and end. The diagram in the top link depicts this situation. Is it correct?

Thanks

randomVariable
  • 305
  • 1
  • 4
  • 12

1 Answers1

2

First, a handful of links that I think are relevant:

self message(non recursive) vs self recursive message

Difference between types of messages in sequence diagrams

Drawing Call Flow with sequence Diagram leads to ambiguity

This is how I would draw what you're trying to model:

Example Sequence Diagram with 'recursive' message

If you read through a number of UML tutorials, you will discover that UML is not an exact science (even though it should be), and there are plenty of interpretations floating around. To make matters worse, different tools give you different implementations of the same concept. As a result of that, two diagrams may look quite different, yet model the same interaction between components.

For example, return messages are optional for synchronous calls:

uml 2.0 sequence diagram: is a reply message obligatory when modeling a synchronous message

My example shows a return line from the 'recursive' message. But that could be skipped.

Community
  • 1
  • 1
Jakub Kaleta
  • 1,740
  • 1
  • 18
  • 25