Chapter 5. Requirements 109
Figure 5-3 PiggyBank use case diagram
Activity diagrams
Activity diagrams can be created to describe the flow of events in the use cases.
An activity diagram is a UML diagram that shows the steps or tasks in a process.
An activity diagram is very similar to a flowchart because it provides a view of the
flow between activities in a process. Activity diagrams are similar to statechart
diagrams because both diagrams model the dynamic parts of a system and they
both belong to a state machine. Activity diagrams typically show how activities
interact with each other; whereas statechart diagrams model the discrete stages
of an object's life cycle.
Activities represent the performance of a task or duty in a workflow; transitions
provide the pathway between each activity. Activity diagrams can show parallel
activities and alternate flow.
When you model a process with an activity diagram, you use initial and final
states to mark the beginning and end of a workflow, and decisions to represent
the specific location where a workflow may branch or merge based upon a guard
condition. Some activities involve simultaneous workflow, and you can use
multiple synchronizations to visually define forks and joins. Swimlanes can be
used to group a set of activities based on roles or responsibilities.
Activity diagrams are helpful because they map out workflow and identify the
most important activities that occur in a process. You normally develop activity
diagrams in all phases of a software project. Possible uses of activity diagrams
include the following:
110 WebSphere Version 5 Application Development Handbook
򐂰 Before starting the software project, you can create activity diagrams to model
the most important workflows in the business. This helps you define the
structure and dynamics of the business.
򐂰 During the requirements phase, you can create activity diagrams to further
break down and visualize the flow of events in use cases.
򐂰 During analysis and design, you can use activity diagrams to help define the
behavior of operations.
Table 5-6 lists the elements for an activity diagram.
Table 5-6 Activity diagram elements
Creating the display balance activity diagram
In this section we guide you through the process of creating an activity diagram
in Rational XDE to model the PiggyBank features. For a description of this
activity diagram, see Table 5-3 on page 104.
򐂰 To create the activity diagram, in the Model Explorer window, expand the Use
Cases package found under the (ItsoAdModel) Use-Case Model.
򐂰 Select Display balance and select Add diagram -> Activity. This gives you an
empty diagram.
򐂰 Name the diagram Display balance activity.
򐂰 To add the Customer swimlane, select Swimlane from the UML Activity toolbox
and click in the diagram. Name the swimlane Customer/Teller. Repeat this
step to add the System swimlane.
򐂰 To merge the swimlanes, select both swimlanes and Swimlane -> Merge
Swimlanes (context).
Element Meaning
Activities Performance of a task or duty in a workflow
Decisions Locations where workflow may branch or merge
Transitions Pathway between activities and/or decision points
Initial and final states Beginning and ending of a workflow or process
Swimlanes Show who or what carries out the activity
Synchronization Splits workflow into parallel flows or brings parallel
flows back together
Chapter 5. Requirements 111
򐂰 To add an initial state, select Initial State from the UML Activity toolbox and
click in the Customer swimlane.
򐂰 To add an activity, select Activity from the UML Activity toolbox and click in
the Customer swimlane beneath the initial state. Add the following text in the
activity: Customer/Teller select Display Balance from Menu. Repeat this
step to add another activity (place it under the System swimlane) and add the
following text in the activity: Displays Accounts with balances.
򐂰 To add a final state, select Final State from the UML Activity toolbox and click
in the System swimlane.
򐂰 To show the flow from the initial state to the first activity, we use a transition.
Select Transition from the UML Activity toolbox, and in the diagram, draw a
line from the initial state to the first activity. Repeat this step to create the
other transitions (use Figure 5-4 as a guide):
First activity and second activity
Second activity to the final state
Figure 5-4 Display balance activity diagram
Repeat the process to create the Transfer money (Figure 5-5) and Cash check
(Figure 5-6) activity diagrams:
򐂰 For a description of the Transfer money activity, see Table 5-4.
򐂰 For a description of the Cash check activity, see Table 5-5.
Note: Merging individual swimlanes does not change any diagram or
model semantics; it just provides a way to align the swimlanes.

Get WebSphere Version 5 Application Development Handbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.