According to the UML specification4, UML activity diagrams are a special case of a state machine in which each state represents an ongoing activity, and transitions to the next state occurs when activities complete. To most people, activity diagrams represent little more than a sophisticated version of traditional flowcharts. As a result, activity diagrams have been the subject of great debate in the UML world. Activity diagrams can be used to describe business processes, sequences of user interactions (use cases), or the implementation of a particular operation. Figure 2 shows a rather trivial activity diagram that describes the check-out process at a basic supermarket. Swimlanes show who is responsible for which activities, and synch bars show forks and joins that enable activities to be performed concurrentlyor at least in no particular sequence.
Figure 2 UML activity diagram.
More-complicated activity diagrams include decision diamonds with guard conditions, iteration markers, signals, and objects that are inputs and outputs of the activities.
Activity Diagrams and Source Code
I don't know any tools that generate source code directly from activity diagrams, or vice-versa. I have encountered some systems that generate business-process descriptions from activity diagrams, and use them to feed workflow engines. In all the cases I have seen, however, activity diagrams have to be extended because they lack the precision or constraints required by these workflow engines.