I'm working on a sequence diagram for a layered system that has a tree hierarchy. Now I have a process that works itself recursively down the tree. Meaning calling the same function on a child object.
I'm talking about a tree like this:
-layer n
-layer n-1
-layer n-2
-...
-layer n-2
-...
-layer n-1
-layer n-2
-...
-layer n-2
-...
Its easy to visualize a recursive process in the single object, but I could figure out how I would visualize recursive process that recursively calls itself on a lower layer object and so on. Is this even possible with an UML sequence diagram?
Best Answer
A sequence diagram doesn't represent a process, but a sequence of interaction between objects, where an object is a specific instance of a class.
Therefore, the representation of the recursion would be similar to the way you represent it in code: in one diagram you would only show what happen at one level of your recursion:
If there is no other object involved in the recursion, you would use a self-message.