Blog Archives
The Importance of the Merge Node in UML Activity Diagrams (Tokens Part II)
In my last post I gave an introduction to tokens and how they're used within UML Activity Diagrams. I also disputed the accuracy of IBM's bording process. Below is my solution to the fragment of the activity diagram that I believe is wrong; afterwards comes an explanation of how my version works. I will then point out common pitfalls that business analysts fall into when drawing up Activity Diagrams. I used a great little online tool called Gliffy to draw up these diagrams, which appears to be great for doing up a UML diagram when you don't have access to enterprise tools.

What's Different? Really the only difference betwen my solution and the one produced by IBM is one node. However choosing this node makes all the difference. Instead of waiting for all incoming tokens, as the join node does, the merge node (also a diamond symbol like a decision node) joins together two incoming edges with tokens. However it only needs to receive one token before it emits its own token which as its name suggests, is great for merging concurrent flows. The Merge Node When I'm peer reviewing other business analyst's Activity Diagrams, the merge node is the one I see used the least. I should be seeing it a lot more though. The reason is that people don't often realise the following:

A merge node is a control node that brings together multiple alternate flows. It is not used to synchronize concurrent flows but to accept one among several alternate flows.
Modelling Workflows Using UML Activity Diagrams – Getting the Basics Right by Visualising the Tokens
UML Activity Diagrams are one of the core UML artefacts that a business analyst can use. Understanding the basics is necessary to model a business process or workflow. Even if a business analyst chooses another notation, a thorough understanding of Activity Diagrams is often a good prerequisite to understanding the nuances of the other notation. For example BPMN uses a lot of the same concepts as activity diagrams but allows for a more diverse and sophisticated depiction of a process.
What is a Token? Activity diagrams work by modelling the flow of control through an invisible object called a token. Tokens aren’t something you depict when drawing an activity diagram, but having an understanding of how they work is useful to make sure you use the right type of notation for the real world process you’re illustrating. Different nodes have different effects on the tokens. The way different nodes treat tokens are described in detail in the UML Superstructure specification, however this is often ignored by people teaching Activity Diagrams to someone unfamiliar with them.A node may begin execution when specified conditions on its input tokens are satisfied; the conditions depend on the kind of node. When a node begins execution, tokens are accepted from some or all of its input edges and a token is placed on the node. When a node completes execution, a token is removed from the node and tokens are offered to some or all of its output edge.
Activity Diagrams as Applications of Graph Theory and Logic There is a reason that all undergraduate IT degrees teach discrete mathematics to their pupils. Even when undertaking analysis and approaching IT from a business orientation there needs to be a basic understanding of both graphy theory and logic. Logic needs to be understood so that a practitioner knows when a node is acting as an AND gate or an XOR gate. Graph theory will teach someone what nodes and edges are and will help them interpret the UML specification when it refers to its symbols as such.
Even the Big Wigs Get it Wrong The following activity diagram is produced in IBM’s introduction to UML Activity Diagrams article – Activity Diagrams: What They Are and How To Use Them. It shows a fairly basic and well understood process – that of making a reservation and boarding some transport. I’ll use the concept of tokens and refer to the UML specification to show how they have misinterpreted the specification. What can be intuitively understood would be incorrectly programmed if interpreted literally as the process is modelled below.

