MeesterPatat
MeesterPatat

Reputation: 2811

How to represent non sequential code in UML?

I can't find any UML diagram to represent non sequential code(e.g. callbacks, code running on different threads).

Is it possible to represent non sequential code in an UML diagram? Is there a non-sequence diagram?

Upvotes: 1

Views: 327

Answers (2)

Gangnus
Gangnus

Reputation: 24474

If the main problem is multithreading, then the Timing diagram can be the most useful.

Upvotes: 0

qwerty_so
qwerty_so

Reputation: 36313

Actually, a sequence diagram is what you are looking for. It shows multiple objects and how they interact. Each object has a specific timeline. The word "sequence" does not refer to the code but how the messages between times (communication between objects) are sequenced.

As @xmojmr points out:

an activity diagram can also be used: it focuses on operations (interesting also for multiple threads with "swimlanes")

There is a 1:1 mapping between both diagram types. While SDs focus on the time line (which goes strictly top down), ADs focus on message overview (a bit like a mind map).

Upvotes: 5

Related Questions