30
Duration : 3 Hrs 1 Ramakant Soni Assistant Professor Dept. of Computer Science B K Birla Institute of Engineering & Technology, Pilani, India Ramakant Soni @ BKBIET Pilani

Lecture 6 activity diagram

Embed Size (px)

Citation preview

Page 1: Lecture 6   activity diagram

Duration : 3 Hrs

1

Ramakant SoniAssistant Professor

Dept. of Computer Science

B K Birla Institute of Engineering & Technology, Pilani, India

Ramakant Soni @ BKBIET Pilani

Page 2: Lecture 6   activity diagram

Activity Diagram

Activity diagram is basically a flow chart torepresent the flow from one activity to anotheractivity.

The activity can be described as an operation

Ramakant Soni @ BKBIET Pilani 2

The activity can be described as an operationof the system.

This flow can be sequential, branched orconcurrent.

Page 3: Lecture 6   activity diagram

Purpose

Activity diagrams are not only used for visualizingdynamic nature of a system but they are also used toconstruct the executable system by using forward andreverse engineering techniques.

It does not show any message flow from one activity to

Ramakant Soni @ BKBIET Pilani 3

It does not show any message flow from one activity toanother.

Page 4: Lecture 6   activity diagram

So the purposes can be described as to:

• Draw the activity flow of a system.

• Describe the sequence from one activity to another.

Ramakant Soni @ BKBIET Pilani 4

• Describe the parallel, branched and concurrent flow of the system.

Page 5: Lecture 6   activity diagram

How to draw Activity Diagram

Before drawing an activity diagram we must have aclear understanding about the elements used in activitydiagram.

First we should identify the following elements :1. Activities2. Association

Ramakant Soni @ BKBIET Pilani 5

2. Association3. Conditions4. Constraints

Once the above mentioned parameters are identified we need tomake a mental layout of the entire flow. This mental layout is thentransformed into an activity diagram.

Page 6: Lecture 6   activity diagram

Example of an order management system

The diagram is drawn with the four main activities :• Send order by the customer• Receipt of the order•Confirm order• Dispatch order

After receiving the order request condition checks are

Ramakant Soni @ BKBIET Pilani 6

After receiving the order request condition checks areperformed to check if it is normal or special order.

After the type of order is identified dispatch activity isperformed and that is marked as the termination of theprocess.

Page 7: Lecture 6   activity diagram

Activity Diagram for order management system

Ramakant Soni @ BKBIET Pilani 7

Page 8: Lecture 6   activity diagram

Initial node

The filled circle is the starting point of the diagram

Activity Diagram components

Final node

The filled circle with a boarder is the ending point. An activity diagram can have zero or more activity final state.

8Ramakant Soni @ BKBIET Pilani

Page 9: Lecture 6   activity diagram

ActivityThe rounded rectangle represents activities that occur. An activity is not necessarily a program, it may be a manual thing also.

Ramakant Soni @ BKBIET Pilani 9

Flow/ edgeThe arrows in the diagram. No label is necessary.

Page 10: Lecture 6   activity diagram

Fork

A black bar ( horizontal/vertical ) with one flow going into it and several leaving it. This denotes the beginning of parallel activities.

Join

A block bar with several flows entering it and one leaving it. this denotes the end of parallel activities

10Ramakant Soni @ BKBIET Pilani

Page 11: Lecture 6   activity diagram

Merge

A diamond with several flows entering and one leaving. The implication is that all incoming flow to reach this point until processing continues

Sub-activity indicatorThe rake in the bottom corner of an activity, indicates that the activity is described by a more finely detailed activity diagram.

11Ramakant Soni @ BKBIET Pilani

Page 12: Lecture 6   activity diagram

Difference between Join and Merge

› A join is different from a merge in that the join synchronizestwo inflows and produces a single outflow. The outflow froma join cannot execute until all inflows have been received.

› A merge passes any control flows straight through it. If twoor more inflows are received by a merge symbol, the actionor more inflows are received by a merge symbol, the actionpointed to by its outflow is executed two or more times.

12Ramakant Soni @ BKBIET Pilani

Page 13: Lecture 6   activity diagram

Decision

› A diamond with one flow entering and several leaving. The flow leaving includes conditions as yes/ no state.

Flow final

› The circle with X through it. This indicates that Process stop at this point.

13Ramakant Soni @ BKBIET Pilani

Page 14: Lecture 6   activity diagram

Accept Event Action

Accept Event Action is an action that waits for theoccurrence of an event meeting specifiedcondition.

14Ramakant Soni @ BKBIET Pilani

Page 15: Lecture 6   activity diagram

Send Signal Action

Send Signal Action is an action that creates asignal instance from its inputs, and transmits it tothe target object, where it may cause the firing ofa state machine transition or the execution of anactivity.

15Ramakant Soni @ BKBIET Pilani

Page 16: Lecture 6   activity diagram

Swim lane

A partition in activity diagram by means of dashed line, called swim lane. This swim lane may be horizontal or vertical.

Vertical Swimlane Horizontal Swimlane

16Ramakant Soni @ BKBIET Pilani

Page 17: Lecture 6   activity diagram

Activity Diagram notation

text Start at the top black circle

If condition 1 is TRUE, go right; if condition 2 is TRUE, go down

At first bar (a synchronization bar), break apart to follow two

Ramakant Soni @ BKBIET Pilani 17

bar), break apart to follow two parallel paths

At second bar, come together to proceed only when both parallel activities are done

Page 18: Lecture 6   activity diagram

Activity Diagram notation

text

Activity – an oval

Trigger – path exiting an activity

Guard – each trigger has a guard, alogical expression that evaluates to“true” or “false”

Synchronization Bar – can break atrigger into multiple triggers

Ramakant Soni @ BKBIET Pilani 18

trigger into multiple triggersoperating in parallel or can joinmultiple triggers into one when allare complete

Decision Diamond – used todescribe nested decisions (the firstdecision is indicated by an activitywith multiple triggers coming outof it)

Page 19: Lecture 6   activity diagram

text

Use Case: Receiving an Order Use Case: Receiving a Supply

Ramakant Soni @ BKBIET Pilani 19

Page 20: Lecture 6   activity diagram

Ramakant Soni @ BKBIET Pilani 20

Use Case: Receiving an Order and Receiving a Supply

Page 21: Lecture 6   activity diagram

Swimlane Activity Diagram

Swimlanes -Activity Diagrams that showactivities by class.

Arrange activity diagramsinto vertical zones separatedby lines.

Ramakant Soni @ BKBIET Pilani 21

by lines.

Each zone represents theresponsibilities of a particularclass.(for example a particulardepartment).

Page 22: Lecture 6   activity diagram

Exercise 1: Online Shopping Process

Scenario:

“Online customer can browse or search items,view specific item, add it to shopping cart, viewand update shopping cart, checkout. User can

Ramakant Soni @ BKBIET Pilani 22

and update shopping cart, checkout. User canview shopping cart at any time. Checkout isassumed to include user registration and login.”

Page 23: Lecture 6   activity diagram

Activity diagram: Online Shopping Process

Ramakant Soni @ BKBIET Pilani 23

Page 24: Lecture 6   activity diagram

Exercise 2: Ticket Vending Machine

Scenario:

“Activity is started by Commuter actor who needs to buy aticket. Ticket vending machine will request trip information fromCommuter. This information will include number and type oftickets, e.g. whether it is a monthly pass, one way or roundticket, route number, destination or zone number, etc.

Ramakant Soni @ BKBIET Pilani 24

ticket, route number, destination or zone number, etc.

Based on the provided trip info ticket vending machine willcalculate payment due and request payment options. Thoseoptions include payment by cash, or by credit or debit card. Ifpayment by card was selected by Commuter, another actor,Bank will participate in the activity by authorizing the payment.“

Page 25: Lecture 6   activity diagram

Activity diagram: Ticket Vending Machine

Ramakant Soni @ BKBIET Pilani 25

Page 26: Lecture 6   activity diagram

Exercise 3: Resolving issues in Software

Scenario:

“Prepare an activity diagram which shows how toresolve an issue in a software design. After ticket iscreated by some authority and the issue is reproduced,

Ramakant Soni @ BKBIET Pilani 26

created by some authority and the issue is reproduced,issue is identified, resolution is determined, issue is fixedand verified, and ticket is closed, if issue was resolved.”

Page 27: Lecture 6   activity diagram

Activity diagram: Resolving issues in Software

Ramakant Soni @ BKBIET Pilani 27

Page 28: Lecture 6   activity diagram

Exercise 4: Single Sign- on for Google Apps

Scenario:To interact with partner companies Google uses single sign-on based on OASIS SAML 2.0protocol. Google acts as service provider with services such as Gmail or Start Pages. Partnercompanies act as identity providers and control user names, passwords, and other informationused to identify, authenticate and authorize users for web applications that Google hosts. Eachpartner provides Google with the URL of its SSO service as well as the public key that Google willuse to verify SAML responses.

When a user attempts to use some hosted Google application, such as Gmail, Google generatesa SAML authentication request and sends redirect request back to the user's browser. Redirect

Ramakant Soni @ BKBIET Pilani 28

a SAML authentication request and sends redirect request back to the user's browser. Redirectpoints to the specific identity provider. SAML authentication request contains the encoded URLof the Google application that the user is trying to reach.

The partner identity provider authenticates the user by either asking for valid login credentialsor by checking for its own valid authentication cookies. The partner generates a SAML responseand digitally signs it. The response is forwarded to Google's Assertion Consumer Service (ACS).

Google's ACS verifies the SAML response using the partner's public key. If the response is validand user identity was confirmed by identity provider, ACS redirects the user to the destinationURL. Otherwise user will see error message.

Page 29: Lecture 6   activity diagram

Activity diagram: Single Sign- on for Google Apps

Ramakant Soni @ BKBIET Pilani 29

Page 30: Lecture 6   activity diagram

References:

[1] http://www.uml-diagrams.org/

[2] http://en.wikipedia.org/wiki/Activity_diagram

[3] http://www.visual-paradigm.com/VPGallery/diagrams/Activity.html

[4] http://www.ibm.com/developerworks/rational/library/3101. html

Ramakant Soni @ BKBIET Pilani 30

ThanksThanks

4/26/2015 30

[5] http://www.uml-diagrams.org/activity-diagrams-examples.html