Lecture 4 - Activity Diagrams
Lecture 4 - Activity Diagrams
Lecture 3
Activity Diagrams
Introduction
• An activity diagram is a behavioral diagram i.e. it depicts the behavior of a system.
• Illustrate the flow of control in a system and refer to the steps involved in the execution
of a use case.
• Provide a high-level view of how a system's processes or workflows function.
• It shows the control flow from a start point to a finish point showing the various decision
paths that exist while the activity is being executed.
• Can depict both sequential processing and concurrent processing of activities using an
activity diagram.
• Shows ‘How’ for a particular system.
Elements of the Activity Diagram
• Activities
• Activities represent tasks or operations that are performed within a system.
• Shows the flow of control from one activity to another.
• The processing within an activity completes and then an automatic transition to the
next activity occurs.
• Example: In a banking system, activities could include "Withdraw Money," "Deposit
Money," and "Check Balance."
• Association
• Represent relationships or connections between activities.
• Illustrate the flow of control or data from one activity to another.
• Example: An association arrow from "Login" to "View Account" indicates that the
"View Account" activity follows the "Login" activity.
• Conditions
• Also known as guards, represent decision points in the flow of activities.
• Allow for branching based on certain conditions, enabling the modeling of decision-
making processes.
• Example: A condition could be represented as "If balance > 0," leading to different
activities based on whether the condition is true or false.
• Constraints
• Represent restrictions or limitations on the execution of activities.
• Provide additional information or rules that need to be considered during the
execution of an activity.
• Example: A constraint could be "[User must be authenticated]" associated with the
"Transfer Funds" activity.
Activity Diagram Notations
• Start / Initial State
• Used to represent the starting point or the initial state of an activity.
Activity
Wake up
Eat breakfast
Sleep
• Action Flow or Control flows
• Action flows or Control flows are also referred to as paths and edges.
• They are used to show the transition from one activity state to another.
• Join
• Join nodes are used to support concurrent activities converging into one.
• For join notations we have two or more incoming edges and one outgoing edge.
• Merge or Merge Event
• Scenarios arise when activities
which are not being executed
concurrently have to be merged.
• Use the merge notation for such
scenarios.
• Can merge two or more activities
into one if the control proceeds
onto the next activity irrespective
of the path chosen.
Inform
Customer
• Swimlanes
• Use swimlanes for grouping related
activities in one column.
• Swimlanes group related activities into one
column or one row.
• Swimlanes can be vertical and horizontal.
• Used to add modularity to the activity
diagram.
• It is not mandatory to use swimlanes.
• They usually give more clarity to the activity
diagram. It’s similar to creating a function in
a program.
• A recommended practice.
• Each swimlane shows the name of the role
at the top, and presents the activities of
each role.
• Final State or End State
• The state which the system reaches when a particular process or activity ends is
known as a Final State or End State.
• Use a filled circle within a circle notation to represent the final state in a state
machine diagram.
• A system or a process can have multiple final states.
How to draw an activity diagram
A sales representative enters details of new order. If the order requires special
materials that are not in stock, place order for special materials with supplier. Other
wise add order to production list. Then schedule a delivery date. If customer has e-
mail address, e-mail customer giving projected delivery date. If the customer does
not have a email address, generate letter to customer giving projected delivery
date.
Exercise 3
• Draw an activity diagram for the procedure of manufacturing order. Consider the
following details.
Company manufacturing is done in the workshop. Therefore the workshop requests next
order for manufacture. If the order is on holding list then issue order to Workshop.
Otherwise take next order from production list and check whether it is ready for
manufacture or not. If the order cannot be manufactured, add order to holding list. If
customer has e-mail address, e-mail customer advising of delay or generate letter to
customer informing of delay in case no email address for the customer. Then take next
order from production list. If the order is ready for manufacturing issue the order to the
workshop.
Exercise 4
• The following scenario explain how a passenger check-in can be done in an airline. Draw
an activity diagram to represent the procedure.
• When a passenger checks in, he or she first shows his or her ticket at the check-in
counter. The ticket will be checked for its validity. If the ticket is not OK the passenger will
be referred to customer service. If the ticket is OK the passenger will check his or her
luggage. If the luggage has excess weight he or she will pay an additional fee. The
luggage will be forwarded to baggage transportation. The passenger receives his or her
boarding pass.