Behavior : Activity Diagrams - What is an Activity Diagram? - Activity Diagram History

25 important questions on Behavior : Activity Diagrams - What is an Activity Diagram? - Activity Diagram History

In UML 1, what was the difference between Activity Diagrams and State Machine Diagrams?

  • UML 1 introduced ACTIVITY DIAGRAMS as a sort of multiple-object State Machine diagram.

  • As state machines are limited to modeling the states of only one object at a time, the Activity Diagram was extended to allow the modeler to show how multiple objects could work together.

  • As such, the UML 1 notation was based on the state machine notation.

  • It looked like a traditional flow chart diagram with regions, called SWIMLANES, each assigned to an object to be responsible for the behaviors in that swimlane.

Because it was not a good idea having two Behavioral diagrams with similar, but not identical semantics, Activity Diagrams changed their foundation.

Instead of being based on events and transitions, Activity Diagrams became based on....

Petri Nets with Token Passing

What was a consequence of changing the foundation of Activity Diagrams?

The terminology became more confusing.

For example:

- What we call Edges, we can also call Flows depending on whether we are considering their ability to connect graphically or their carrying capacity.
  • Higher grades + faster learning
  • Never study anything twice
  • 100% sure, 100% understanding
Discover Study Smart

When are these subrodinate behaviors initiated?

These subordinate behaviors may be initiated because predecessor behaviors in the model finish their execution or because the input objects and data become available to the subordinate behavior or because of triggering events from outside.

The flow of execution is modeled as....

Activity Nodes, connected by Activity Edges

What are considered as Executable Nodes?

Both Actions and lower level Activities

An Activity Node can also be a...

CONTROL NODE that controls features such as
  • Synchronization
  • Decision
  • Concurrency

The ACTIVITY EDGES indicate the flow of...

TOKENS, carrying control or object (data)

When begins an Activity Node start to execute?

Essentially, the Activity nodes start to execute when all their immediate predecessors finish executing.

What is an control edge/flow?

In UML 2.5, a control edge/flow carries a control token, just a permission to start executing

Control tokens/flows   VS   Object tokens/Flows

In the examples below, we use control tokens and control flows for illustrative purposes.

Though object tokens and flows look a little different and work slightly differently from their control cousins, they have similar essential effects.


What notations do we see in the diagram?

In Fig. 16.1, we show a very simple Activity Diagram that illustrates an Action (STUDY FOR OCUP 2 FIRST EXAM), an INITIAL NODE (sometimes called a START NODE), and a FINAL NODE.


The edges between them are control flow edges, as control information flows on these edges.

What if there was a second Action after Study?

If there were a second action after the STUDY for action (between the action and the final node), also connected by an arrow, this action would be executed after the first action finished, and so on until the final node was reached.

What are these tagged icons (with the folded corner)

These are Notes or Comments.

These comments are attached by dashed lines to elements that need to be annotated

They can appear on any diagram.

The Action on the diagram, “Study for the OCUP 2 First Exam,” is an OPAQUE ACTION.


What is an Opaque Action?

An opaque action or behavior is one that is not written in native UML.

It is not expected that UML environment would be able to enforce the rules and execute.
  

How do we recognize that the diamond on the left is a Decision Node?

We recognize the decision node diamond because it has one edge going in and more than one labeled flow going out.

How do we recognize that the diamond on the right is a Merge Node?

We can recognize that this second diamond is a merge node because it has multiple ways in and only one nonlabeled exit.

How do we call the labels at the Decision node?

Guards

What are Guards exactly?

The labels, called GUARDS, when they evaluate to true, enable the flow in that direction.

This pattern of Decision node followed by alternative behaviors followed by a Merge node typifies an ....

This pattern of Decision node followed by alternative behaviors followed by a Merge node typifies an


IF-THEN or a CASE/SWITCH pattern in code when only one condition can be true.

How can we produce Loops in Activity Diagrams?

To produce a loop, you usually need to reverse the order of the decision and merge node

(first Merge than Decision)

Why can't this diagram execute?

The rule is:


For an action to begin executing, all of the mandatory input edges must be populated.



Because of this rule, the diagram will never execute.

Borrow this Book can only start when it has both input flows available at the same time:

The one from the Initial Node (from the left) and the one from the decision diamond (from the top).

This can never happen.

Therefore, the execution would stall. It is not an illegal diagram so your tool may not complain, so be wary.

There is a similar rule for an action finishing, though it does not cause as many problems.


What is this rule?

When an action finishes, all the output edges will be populated.

What do we technically not need in this diagram?

We also do not technically need the merge diamond in this case.

All the edges could directly connect to the final node.

In Fig. 16.7, you should be able to identify which diamonds represent decisions and which diamonds represent merges.

You should also be able to detect which decision goes with which merge 

Reminder:

Decision: 1 goes in, multiple goes out

Merge:  Multiple going in, 1 goes out

The question on the page originate from the summary of the following study material:

  • A unique study and practice tool
  • Never study anything twice again
  • Get the grades you hope for
  • 100% sure, 100% understanding
Remember faster, study better. Scientifically proven.
Trustpilot Logo