Search code examples
umlactivity-diagram

Difference between event and activity in UML


I am trying to learn UML 2, specifically activity diagram and I am little bit confused about using events over activities.

So my question is - When it is necessary to use accept event over activity or where is it more convenient ?

Thank you for any help.


Solution

  • Events happen "out of order" while Actions (not Activities!) appear in a controlled flow where the flow is controlled by conditions. The "out of order" can be timers or exceptions (like in the last example here).

    Note: an Activity is a sequence of Actions (short pieces of things done in one place so they have some elementary meaning). You can use an Activity within Actions only if you use it as Invocation. It will look like this:

    enter image description here

    An accept event can handle unsolicited input. This might be an "urgent call", a "flash stroke", or something like that. If that event happens, a new token is created and control flow will continue in parallel with the "normal flow". In order to cancel the normal flow you need to create an interruptible region (like in the above example) and exit from the region thereby destroying the "normal" token flow.