UML activity diagrams belong to the group of behavior diagrams in unified modeling language. While a structure diagram records the state of a system, i.e. the existing objects and their hierarchies as well as connections to each other at a certain point, behavior diagrams describe the chronological flow of data streams. In addition to the activity diagram, the “use case diagram” and the “state machine diagram” belong to this group. Activity diagrams are similar in use and notation to flowcharts (especially program flowcharts), but are tailored to object-oriented programming.
Basically, it can be said that the activity diagram models the flow of activities. These can be processes within a computer system, use case processes, or business processes. For example, the activity "preparing a cheese omelet" can be broken down into many small sub-activities: the actions. These can take place chronologically. One action would be "breaking eggs," followed by the action "whisking eggs while seasoning." The first action requires the second. They're in flux, so to speak.
Parallel processes can also be illustrated. If two people are in charge of preparing the omelet, this enables the actions to be carried out simultaneously i.e. breaking eggs and chopping herbs. This means that the activity has two starting points. The people start their activity at these points and go from one action to the next. Although these two people play an important role in the activity diagram, they don’t have their own notation. You move from a starting point to an end point, crossing control or object flows to move from one action to the next. In between, there are occasional barriers, so-called pins, which they only let things through under certain conditions e.g. when both persons are present.
In the activity diagram, these “persons” are referred to as tokens. There are two types of tokens in the UML activity diagram: the first is the object token, which transmits information to the action node, starts an action there and (if specified) saves the result as a value. If the result and token correspond to the specifications defined in the pin, this output pin sends the object token via an object flow to the next action. Before the token can start this action, it must comply with the input pin specifications. Control tokens, on the other hand, only migrate over control flows and serve as markers. You start an action but do not transfer any data.
In the example described above (“preparing a cheese omelet”), we use the activity diagram to illustrate the time sequence of a use case. Use case diagrams, on the other hand, illustrate the system requirements that should be met for a use case.
UML 2 activity diagram don’t solely have to be used for everyday scenarios. First and foremost, they help you to illustrate the processes in software systems in a structured manner. This way, business analysts, for example, set guidelines for software developers. The experts exchange information about the graphic language on a generally understandable and clear level. Once all processes have been settled and errors ironed out, the activity diagram serves as a clean template for programming.
If you integrate a suitable UML tool into your integrated development environment, the diagram can act as a code framework into a programming language using XML conversion.
The Object Management Group (OMG), which specifies the UML, summarizes the possible tasks of UML 2 activity diagrams.
- Procedural computer programming that assigns hierarchies to activities
- In objectoriented models, activities act as methods that describe processes in more detail
- For illustration workflows and business processes
- In computerbased application systems, activities specify processes at system level