Sequence diagrams, collaboration diagrams, activity diagrams, and statechart diagrams give dynamic views of a model. They let you look inside to the mechanism for action inside the model. Sequence diagrams and collaboration diagrams focus on the messages involved in completing a single process. Statechart diagrams focus attention on a single object. Activity diagrams focus on the flow of activities in performing a single task.
In this page, we will see how to how asynchronous or concurrent activities are modeled in sequence diagrams and state diagrams.
Sequence diagrams with asynchronous messages
A message is asynchronous if it allows its sender to send additional messages while the original is being processed. The timing of an asynchronous message is independent of the timing of the intervening messages.
The following sequence diagram illustrates the action of a nurse requesting a diagnostic test at a medical lab. There are two asynchronous messages from the Nurse: 1) ask the MedicalLab to reserve a date for the test and 2) ask the InsuranceCompany to approve the test. The order in which these messages are sent or completed is irrelevant. If the InsuranceCompany approves the test, then the Nurse will schedule the test on the date supplied by the MedicalLab.
The UML uses the following message conventions.
Symbol | Meaning |
---|---|
![]() |
simple message which may be synchronous or asynchronous |
![]() |
simple message return (optional) |
![]() |
a synchronous message |
![]() |
an asynchronous message |
Concurrency and asynchronization in statechart diagrams
States in statechart diagrams can be nested. Related states can be grouped together into a single composite state. Nesting states is necessary when an activity involves concurrent or asynchronous subactivities.
The following statechart diagram models an auction with two concurrent threads leading into two substates of the composite state Auction: Bidding and Authorizing Credit. Bidding itself is a composite state with three substates. Authorizing Credit has two substates.
Entering the Auction requires a fork at the start into two separate threads. Unless there is an abnormal exit (Cancelled or Rejected), the exit from the Auction composite state occurs when both substates have exited.
Copyright © 2002 TogetherSoft, Inc. All rights reserved.