State Machine View
A state machine models the possible lifecycle of states for an object of a class. A state machine contains states connected by transactions. Each state models a period of time during the life of an object during which it satisfies certain conditions. When an event occurs, it may cause the object to transition to a new state as a result. When the transition from one state to another occurs, this may have an effect (action or activity).
State Machine Diagram
A state machine diagram shows the state machine for part of a system, illustrating the states, transitions, events and activities involved. A state machine diagram shows the dynamic view of a system, illustrating the flow of control from state to state within a single object.
An activity shows the flow of control among the activities involved in performing a calculation or workflow. An action is a primitive computational step, and an activity node is a group of actions or sub-activities. An activity describes both sequential and concurrent computation. Activities are shown using activity diagrams.
An activity diagram shows the flow of control from activity to activity within a system. They are the flowcharts of the UML. Unlike traditional flowcharts, and activity diagram can show concurrency as well as branches of control. Activity diagrams address the dynamic view of a system. They are useful in modelling the function of a system, emphasising the flow of control among elements in the system.
The interaction view describes sequences of message exchanges among the parts of a system. An interaction is based on a structured classifier, or collaboration with roles in the interaction filled with objects in a particular use of an interaction. This shows the flow of control across many objects.
The interaction view is shown using two diagrams that focus on different aspects; sequence diagrams and communication diagrams.
A sequence diagram is an interaction diagram that emphasises the time-ordering of messages.
Each role is shown as a vertical lifeline representing the role over time through the entire interaction. Messages are shown as arrows between the lifelines. Sequence diagrams can show control constructs such as loops, conditionals and parallel execution.
A communication diagram emphasises the structural organisation of the objects or roles that send and receive messages. This diagram shows the roles as a geometric arrangement with messages among these roles represented as arrows attached to links between the roles. The sequencing of messages is indicated by sequence numbers prefixed to the message descriptions.
Sequence diagrams and communication diagrams represent similar basic concepts, but with different view of these concepts.