These diagrams have a lot in common with Statechart diagrams in terms of the symbols used and their underlying meaning. However, instead of concentrating on the state of an object, they generally focus on the dynamic behavior of individual methods and the flow of actions within.
In VB terms, a single activity diagram usually maps to a single VB method. You should use activity diagrams only when dealing with complex operations that are easier to understand visually than in code.
The interesting items on activity diagrams are action and transitions. An action usually maps to either a single VB statement or a cohesive group of statements. We can see how this relates to our previous example. The procedure call to SoundAlarm can be treated as a single action in an activity diagram. Transitions are simply the invisible transition from one VB statement to the next so they don't have any concrete mapping to deal with.
The text associated with an action, can also be conveniently mapped to a comment near to the statements, particularly when the statements themselves aren't self-explanatory.
For completeness, here is an example activity diagram. This is the PerformUseCase operation on the <<controller>> class TransferFunds we looked at earlier:
Note that the code mapped from this is identical to that produced from the sequence diagram for the same operation, so we won't repeat it.
Was this article helpful?