Basma Hussien
12/21/2022
Contents
1 Activity Diagrams
2 Sequence Diagrams
3 Package Diagrams
4 UML Tool
12/21/2022
Activity Diagrams
• An activity diagram shows flow control within a system
✓ i.e. Shows a procedural flow for a process
Call Open Move
Elevator Elevator
• An activity diagram is a special case of a state chart diagram in
which states are activities (“functions”)
• Two types of states:
✓ Action state:
▪ Cannot be decomposed any further
▪ Happens “instantaneously” with respect to the level of abstraction used in the
model
✓ Activity state:
▪ Can be decomposed further
▪ The activity is modeled by another activity diagram
4
12/21/2022
Activity Diagram (cont.)
Activity with details:
Use Elevator
Call Open Move
Elevator Elevator
Use Elevator
Call Open Move
Elevator Elevator
5
12/21/2022
Activity Diagram (cont.)
Connectors:
• Simplify large activity diagrams by splitting edges using connectors.
• Each connector is given a name.
• Place the name of a connector in a circle and then show the first half of an edge
pointing to the connector and the second half coming out of the connector
Call Open
Elevator Elevator p
Move
p
6
12/21/2022
Activity Diagram (cont.)
Parameter Nodes:
Create Press Package
Wood Ream
Pulp Paper Reams
Object Nodes:
Process Paper Ship
Paper Paper
Pins:
paper paper
Process Ship
Paper Paper
Tokens:
{ weight = 9 } Register
Player Team 7
12/21/2022
Activity Diagram (cont.)
Modeling Decisions:
Guard condition
[FirstDoor]
Call Move UP
Elevator
[InBetween]
[LastDoor] Check Move
Floor UP/Down
Move Down
8
12/21/2022
Activity Diagrams (cont.)
Modeling Concurrency:
• Fork: Splitting the flow of control into multiple
threads.
• Join: Synchronization of multiple activities.
CheckFloor
Splitting Synchronization
num
Call CloseDoor Move
Elevator
Illimunate
9
12/21/2022
Activity Diagram (cont.)
Activity Partitions:
Hire Employee
Resources
Human
Confirm Emp. Prepare Benefits Submit Emp. Info to X
Acceptance Paperwork insurance comp.
Management Department
Set up user X
IT
account
Facilities
Set up office X
space
10
12/21/2022
FlowChart & Activity Diagram
❖Is Flowchart a UML diagram?
▪ Both are similar…
▪
▪ But, An activity diagram is a UML diagram.
A Flowchart, on the other hand, is NOT a UML
diagram, it is a graphical diagram that
represents algorithm to solve a given problem
“a step by step procedure”
UML Sequence Diagrams
• Objects are represented by
:TicketMachine rectangles “Underlined”
Passenger
• Messages are represented by
arrows
selectZone()
• Activations are represented by
narrow rectangles
insertCoins()
• Lifelines are represented by
vertical dashed lines
pickupChange()
• Used during requirements
analysis
pickUpTicket()
✓ To refine use case descriptions
✓ to find additional objects
(“participating objects”)
• Used during system design
✓ to refine subsystem interfaces
13
12/21/2022
Nested messages
:ZoneButton :TarifSchedule :Display
Passenger
selectZone()
lookupPrice(selection)
price
displayPrice(price)
Dataflow …to be continued...
• The source of an arrow indicates the activation which
sent the message
• Horizontal dashed arrows indicate data flow
• An activation is as long as all nested activations
14
12/21/2022
Iteration & condition
…continued from previous slide...
:ChangeProcessor :CoinIdentifier :Display :CoinDrop
Passenger
*insertChange(coin) lookupCoin(coin)
price
Iteration
displayPrice(owedAmount)
[owedAmount<=0]returnChange(-owedAmount)
Condition
…to be continued...
• Iteration is denoted by a * preceding the message name
• Condition is denoted by Boolean expression in [ ]
before the message name
15
12/21/2022
Creation and destruction
…continued from previous slide...
:ChangeProcessor
Passenger
Creation
createTicket(selection)
:Ticket
print()
free() Destruction
• Creation is denoted by a message arrow pointing to the
object.
• Destruction is denoted by an X mark at the end of the
destruction activation.
12/21/2022 16
Package Diagram
• Provide a way to group related UML elements and scope their names
• Provide a great way to visualize dependencies between parts of system.
• Often used to look for problems or determine compilation order.
• All UML elements can be grouped into packages, including packages
themselves.
• Each package has a name that scopes each element in the package.
Utilities Utilities
+ + +
Timer Queue
Timer Queue
- Timeout : int - ElementsNo : int
- Started : bool - addElement(Object)
Semaphore
Semaphore
- take() : int 18
12/21/2022 - give() : int
Package Diagram (cont.)
Visibility:
• Elements may have only one of two levels of visibility: public or private.
• Public visibility means the element may be used outside the package
(Utilities::Timer)
• Private visibility means the element may be used only by other elements of
the same package
Utilities
+ Timer - LinkedList In this package,
LinkedListis a helper
class for Queue, so it
is peivate
+ Queue
19
12/21/2022
Package Diagram (cont.)
Importing and Accessing Packages:
• When accessing elements in one package from a different package, you must qualify
the name of the element you are accessing
• UML allows a package to import another package. Elements of the imported package
are available without qualification in the importing package
• By default, imported elements are given public visibility in the importing package.
• Use <<access>> to specify that imported elements should have private visibility
<<import>> Transportation
RoutePlanning
Transportation
RoutePlanning
Algorithms
20
12/21/2022
Package Diagram (cont.)
Use Case Packages:
• Use case packages organize the
functional behavior of a system
during analysis.
• The packages provide
understandable terms for team
members outside the analyst
team. Managers can discuss the
project at an appropriate level of
detail without getting bogged
down in details.
• This example shows the major
functional areas of a content
management system.
23
12/21/2022
UML Certification
12/21/2022 24