1

UML specs 2.5 says:

The effect of one ActivityNode on another is specified by the flow of tokens over the ActivityEdges between the ActivityNodes.

But above definition is obscure; specially because tokens are not explicitly modeled in an Activity.

After reading 15.2.3.3 Activity Edges section of specifications, I think purpose of them is:

to capable the diagram to describe it may wait for other token or refuse flow instead of entering next node immediately

Is it true? Also is it the only purpose of tokens? If it is true, why we do not use a decision node with a condition and a end flow node for showing refusing flow under that condition instead of token and guards? Or grouping information into larger objects node which carries all necessary data instead of using weight?

hasanghaforian
  • 13,858
  • 11
  • 76
  • 167

1 Answers1

4

Activity diagrams and state machines are both derived from Petri nets. Giving a full description would blow this answer, so I try to boil it down.

A token is, so to say, a bit of information. It's atomic and can not be split. Rather it is created from a "big bang" out of an event which is defined in the context (shown usually by a large black dot). It travels along InformationFlow connectors (eventually blocked by guards where it has to wait) to nodes. Nodes have 1 to many InformationFlow connectors. A node becomes active when at all of its incoming InformationFlow connectors a token has arrived. When the node finalizes it sends single tokens along all its outgoing InformationFlow connectors (at least UML actions do so which is called implicit fork). There are special nodes like fork and merge which behave a bit different (see the specs). Finally tokens can fall in a sink (usually a circle with a fat dot inside) where they just vanish as they appeared.

So from a single token (not going to explain the details/issues of multiple start points here) emerging from a start node this token travels in the net, eventually creating other tokens all circulating until (usually) all tokens have gone to sinks. During that the net is said to be active.

tl;dr No, your assumption is not correct that way.

qwerty_so
  • 35,448
  • 8
  • 62
  • 86
  • Thank you for your response. Does in your answer the word "vertices" means "edges"? Because it seems there is no difference between "vertex" and "node" as it is described in https://stackoverflow.com/a/14111726/1043882 – hasanghaforian Sep 05 '18 at 02:59
  • Are there other nodes like "fork" and "merge" that do not wait for *all* incoming edges to arrive before exiting? – hasanghaforian Sep 05 '18 at 03:07
  • Uh. I'll check about vertex/edge (English is not my mother tongue). I was using vertex for th connection between nodes. This is probably a false friend :-/ – qwerty_so Sep 05 '18 at 08:06
  • The meaning of fork/merge is NOT that they don't wait. Only the merge does not wait. And it's the only one with that purpose. Fork/join is different again. I can explain that in a new question if you need. – qwerty_so Sep 05 '18 at 08:08
  • I changed the wording. I now use `InformationFlow` instead. There are also `ObjectFlow` connectors which behave similarly with subtle difference and they look the same. – qwerty_so Sep 05 '18 at 08:16
  • Thank you again. I posted another question: https://stackoverflow.com/q/52181253/1043882. Please see it. – hasanghaforian Sep 05 '18 at 09:08