Activity diagrams


Published on

This silde he;understand the rules and styles guidelines for activity diagrams.
Create functional model using activity diagrams.

1 Comment
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Activity diagrams

  1. 1. Activity Diagrams Week 4 TID2033
  2. 2. Chapter Objectives <ul><li>After studying this chapter you should be </li></ul><ul><li>able to: </li></ul><ul><li>Understand the rules and styles guidelines for activity diagrams. </li></ul><ul><li>Create functional model using activity diagrams. </li></ul>
  3. 3. What Is an Activity Diagram? <ul><li>Activity diagrams and use cases are logical model which describe the business domain’s activities without suggesting how they are conduct. </li></ul><ul><li>A diagram that emphasizes the flow of control from activity to activity in an object. </li></ul>
  4. 4. What Is an Activity Diagram? (cont…) <ul><li>Similar to the traditional program flowchart . </li></ul><ul><li>Used to provide detail for complex algorithms. </li></ul><ul><li>Portray the primary activities and the relationships among the activities in a process. </li></ul>
  5. 5. Drawing Activity Diagrams <ul><li>Purpose </li></ul><ul><ul><li>to model a task (for example in business modelling) </li></ul></ul><ul><ul><li>to describe a function of a system represented by a use case </li></ul></ul><ul><ul><li>to describe the logic of an operation </li></ul></ul><ul><ul><li>to model the activities that make up the life cycle in the Unified Process </li></ul></ul>
  6. 6. Elements of an Activity Diagrams Synchronization bar – horizontal or vertical bars denoting parallel or concurrent paths of activities Decision point – a diamond symbol containing a condition whose results provide transitions to different paths of activities Transition – a movement from one activity or state to another Activity a behavior that an object carries out while in a particular state
  7. 7. Notation of Activity Diagrams <ul><li>Activities </li></ul><ul><ul><li>rectangle with rounded ends </li></ul></ul><ul><ul><li>meaningful name </li></ul></ul><ul><li>Transitions </li></ul><ul><ul><li>arrows with open arrowheads </li></ul></ul>Fill in registration form Register subject
  8. 8. Notation of Activity Diagrams <ul><li>Start state </li></ul><ul><ul><li>black circle </li></ul></ul><ul><li>Decision points </li></ul><ul><ul><li>diamond </li></ul></ul><ul><li>Guard conditions </li></ul><ul><ul><li>in square brackets </li></ul></ul><ul><li>Final state </li></ul><ul><ul><li>black circle in white circle </li></ul></ul>[campaign to add] [no campaign to add] Add a New Client Assign Staff Contact Add New Campaign
  9. 9. Notation of Activity Diagrams <ul><li>Alternative notation for branching: </li></ul><ul><ul><li>alternative transitions are shown leaving the activity with guard conditions </li></ul></ul><ul><li>Note that guard conditions do not have to be mutually exclusive, but it is advisable that they should be </li></ul>[campaign to add] [no campaign to add] Add a New Client Assign Staff Contact Add New Campaign
  10. 10. Notation of Activity Diagrams <ul><li>Object flows </li></ul><ul><ul><li>dashed arrow </li></ul></ul><ul><li>Objects </li></ul><ul><ul><li>rectangle </li></ul></ul><ul><ul><li>with name of object underlined </li></ul></ul><ul><ul><li>optionally shows the state of the object in square brackets </li></ul></ul>Record completion of a campaign :Campaign [Active] :Campaign [Completed]
  11. 11. Notation of Activity Diagrams <ul><li>Swimlanes </li></ul><ul><ul><li>vertical columns </li></ul></ul><ul><ul><li>labelled with the person, organisation or department responsible for the activities in that column </li></ul></ul>Record Completion of a campaign Issue invoice Campaign Manager Client Accountant Pay invoice Record client payment
  12. 12. Activity diagram with synchronization bars Top synchronization bar is a fork. Bottom synchronization bar is a join.
  13. 13. Guidelines for Creating Activity Diagrams <ul><li>Set the context or scope of the activity being modeled. </li></ul><ul><li>Identify the activities, control flows, and object flows that occur between the activities. </li></ul><ul><li>Identify any decisions that are part of the process being modeled. </li></ul><ul><li>Identify any prospects for parallelism in the process. </li></ul><ul><li>Draw the activity diagram. </li></ul>Scott Ambler
  14. 14. Drawing Activity Diagrams <ul><li>What is the purpose? </li></ul><ul><ul><li>This will influence the kind of activities that are shown </li></ul></ul><ul><li>What is being shown in the diagram? </li></ul><ul><ul><li>What is the name of the business process, use case or operation? </li></ul></ul><ul><li>What level of detail is required? </li></ul><ul><ul><li>Is it high level or more detailed? </li></ul></ul>
  15. 15. Drawing Activity Diagrams <ul><li>Identify activities </li></ul><ul><li>Organise the activities in order with transitions </li></ul><ul><li>Identify any alternative transitions and the conditions on them </li></ul><ul><li>Add transitions and guard conditions to the diagram </li></ul>
  16. 16. Drawing Activity Diagrams <ul><li>Identify any processes that are repeated </li></ul><ul><li>Add transitions and guard conditions to the diagram </li></ul>
  17. 17. Drawing Activity Diagrams <ul><li>Are all the activities carried out by the same person, organisation or department? </li></ul><ul><li>If not, then add swimlanes to show the responsibilities </li></ul><ul><li>Name the swimlanes </li></ul><ul><li>Show each activity in the appropriate swimlane </li></ul>
  18. 18. Drawing Activity Diagrams <ul><li>Are there any object flows and objects to show? </li></ul><ul><ul><li>these can be documents that are created or updated in a business activity diagram </li></ul></ul><ul><ul><li>these can be object instances that change state in an operation or a use case </li></ul></ul><ul><li>Add the object flows and objects </li></ul>
  19. 19. When Not to Use Activity Diagram <ul><li>An activity diagram should be avoided if: </li></ul><ul><ul><li>The use case is simple and the graphical representation will not be helpful </li></ul></ul><ul><ul><li>The purpose is to examine how object collaborate – an interaction diagrams should be used instead. </li></ul></ul><ul><ul><li>The purpose is to see how an object behaves over its lifetime. – used a statechart diagrams instead </li></ul></ul>
  20. 20. Summary <ul><li>In this lecture you have learned about: </li></ul><ul><li>The purpose of activity diagrams </li></ul><ul><li>The notation of activity diagrams </li></ul><ul><li>How to draw activity diagrams </li></ul>
  21. 21. Let’s do the exercise
  22. 22. Dentist Office System <ul><li>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. </li></ul>
  23. 23. Use case name: Withdraw money <ul><li>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. </li></ul>