activity diagrams

23
Activity Diagrams TID2033

Upload: jalaxy-jahury

Post on 17-Dec-2014

2.701 views

Category:

Documents


1 download

DESCRIPTION

Understand the rules and styles guidelines for activity diagrams.

TRANSCRIPT

Page 1: Activity diagrams

Activity Diagrams

TID2033

Page 2: Activity diagrams

Chapter Objectives

After studying this chapter you should be

able to: Understand the rules and styles guidelines

for activity diagrams. Create functional model using activity

diagrams.

Page 3: Activity diagrams

What Is an Activity Diagram?

Activity diagrams and use cases are logical model which describe the business domain’s activities without suggesting how they are conduct.

A diagram that emphasizes the flow of control from activity to activity in an object.

Page 4: Activity diagrams

What Is an Activity Diagram? (cont…)

Similar to the traditional program flowchart. Used to provide detail for complex

algorithms. Portray the primary activities and the

relationships among the activities in a process.

Page 5: Activity diagrams

Drawing Activity Diagrams

Purpose to model a task (for example in business

modelling) to describe a function of a system represented by

a use case to describe the logic of an operation to model the activities that make up the life cycle

in the Unified Process

Page 6: Activity diagrams

Activity

a behavior that an object carries out while in a particular state

Transition – a movement from one activity or state to another

Decision point – a diamond symbol containing a condition whose results provide transitions to different paths of activities

Synchronization bar – horizontal or vertical bars denoting parallel or concurrent paths of activities

NewActivity

Elements of an Activity Diagrams

Page 7: Activity diagrams

Notation of Activity Diagrams

Activities rectangle with rounded ends meaningful name

Transitions arrows with open

arrowheads

Fill in registration form

Register subject

Page 8: Activity diagrams

Notation of Activity Diagrams

Start state black circle

Decision points diamond

Guard conditions in square brackets

Final state black circle in white circle

[campaign to add]

[no campaign to add]

Add a New Client

Assign StaffContact

Add New Campaign

Page 9: Activity diagrams

Notation of Activity Diagrams

Alternative notation for branching: alternative transitions

are shown leaving theactivity with guardconditions

Note that guard conditions do not have to be mutually exclusive, but it is advisable that they should be

[campaign to add]

[no campaign to add]

Add a New Client

Assign StaffContact

Add New Campaign

Page 10: Activity diagrams

Notation of Activity Diagrams

Object flows dashed arrow

Objects rectangle with name of object

underlined optionally shows the

state of the object in square brackets

Record completionof a campaign

:Campaign

[Active]

:Campaign

[Completed]

Page 11: Activity diagrams

Notation of Activity Diagrams

Swimlanes vertical columns labelled with the

person, organisationor departmentresponsible for theactivities in thatcolumn

Record Completionof a campaign

Issue invoice

CampaignManager

ClientAccountant

Pay invoice

Record clientpayment

Page 12: Activity diagrams

Activity diagram with synchronization bars

Top synchronization bar is a fork.

Bottom synchronization bar is a join.

Page 13: Activity diagrams

Guidelines for Creating Activity Diagrams

Set the context or scope of the activity being modeled.

Identify the activities, control flows, and object flows that occur between the activities.

Identify any decisions that are part of the process being modeled.

Identify any prospects for parallelism in the process.

Draw the activity diagram.

Scott Ambler

Page 14: Activity diagrams

Drawing Activity Diagrams

What is the purpose? This will influence the kind of activities that are

shown What is being shown in the diagram?

What is the name of the business process, use case or operation?

What level of detail is required? Is it high level or more detailed?

Page 15: Activity diagrams

Drawing Activity Diagrams

Identify activities Organise the activities in order with

transitions Identify any alternative transitions and the

conditions on them Add transitions and guard conditions to the

diagram

Page 16: Activity diagrams

Drawing Activity Diagrams

Identify any processes that are repeated Add transitions and guard conditions to the

diagram

Page 17: Activity diagrams

Drawing Activity Diagrams

Are all the activities carried out by the same person, organisation or department?

If not, then add swimlanes to show the responsibilities

Name the swimlanes Show each activity in the appropriate

swimlane

Page 18: Activity diagrams

Drawing Activity Diagrams

Are there any object flows and objects to show? these can be documents that are created or

updated in a business activity diagram these can be object instances that change state in

an operation or a use case Add the object flows and objects

Page 19: Activity diagrams

When Not to Use Activity Diagram

An activity diagram should be avoided if: The use case is simple and the graphical

representation will not be helpful The purpose is to examine how object collaborate

– an interaction diagrams should be used instead. The purpose is to see how an object behaves

over its lifetime. – used a statechart diagrams instead

Page 20: Activity diagrams

Summary

In this lecture you have learned about: The purpose of activity diagrams The notation of activity diagrams How to draw activity diagrams

Page 21: Activity diagrams

Let’s do the

exercise

Page 22: Activity diagrams

Dentist Office System Create an activity diagram for the following dentist office

system. Whenever new patients are seen for the first time, they complete a patient information form that asks their name, address, phone number and brief medical history, which are stored in the patient information file. When a patient calls to schedule a new appointment or change an existing appointment, the receptionist checks the appointment file for an available time. Once a good time is found for the patient, the appointment is scheduled. If the patient is a new patient, an incomplete entry is made in the patient file; the full information will be collected when they arrive for their appointment. Because appointments are often made so far in advance, the receptionist usually mails a reminder postcard to each patient two weeks before their appointment.

Page 23: Activity diagrams

Use case name: Withdraw money The use case is initiated by the customer. Customer

inserts the bank-card and enters PIN. ATM SYSTEM authorizes the customer. ATM SYSTEM will eject the card if the authorization is unsuccessful and at the end of every transaction. Then the customer will take the card and leave. If the authorization is successful, ATM SYSTEM asks customer “how much” and the customer enters the amount and ATM SYSTEM checks if amount <= balance. If yes, customer gets the money and ATM SYSTEM updates balance. (Show two activities – customer getting money and ATM SYSTEM updating the balance as parallel events.) If amount > balance, ATM SYSTEM displays an error message and aborts the current transaction.