UML
UML
4
UML
5
UML
6
UML
8
Use Cases
• What is a Use Case
A formal way of representing how a business system
interacts with its environment
Illustrates the activities that are performed by the
users of the system
A scenario-based technique in the UML
A sequence of actions a system performs that yields a
valuable result for a particular actor.
Use Case Analysis
• What is an Actor?
– A user or outside system that interacts with
the system being designed in order to obtain
some value from that interaction
• Use Cases describe scenarios that describe the
interaction between users of the system (the actor)
and the system itself.
Use Cases
• Use case diagrams describe what a
system does from the standpoint of an
external observer. The emphasis is on
what a system does rather than how.
• A patient calls the clinic to make an appointment for a yearly checkup. The
receptionist finds the nearest empty time slot in the appointment book and
schedules the appointment for that time slot. "
Questions for Identifying People Actors
• A patient calls the clinic to make an appointment for a yearly checkup. The
receptionist finds the nearest empty time slot in the appointment book and
schedules the appointment for that time slot. "
• The picture below is a Make Appointment use case for the medical clinic.
• The actor is a Patient. The connection between actor and use case is a
communication association (or communication for short).
k figures. Use cases are ovals. Communications are lines that link actors to use cases.
Actors are stick figures. Use cases are ovals. Communications are lines that link
actors to use cases.
Use Case Componentss
Make
Appointment
Use Case - Actor
Use Case - Relationships
• Relationships
– Represent communication between actor and use case
– Depicted by line or double-headed arrow line
– Also called association relationship
Make
Appointment
Use Case - Relationships
• Boundary
– A boundary rectangle is placed around the perimeter of
the system to show how the actors communicate with
the system.
Make
Appointment
Use-Case Diagram
A use case diagram is a collection of actors, use cases, and their communications.
There can be 5 relationship types in a use case
diagram.
29
Association between actor and use case
30
Generalization of an actor
31
Extend between two use cases
32
Extend between two use cases
33
Extend between two use cases
35
Extend between two use cases
36
Extend between two use cases
37
Include between two use cases
The base use case is incomplete without the included use case.
The included use case is mandatory and not optional.
38
Include between two use cases
39
Include between two use cases
40
Include and exclude relationship
41
Generalization of a use case
• This is similar to the generalization of an actor. The behavior
of the ancestor is inherited by the descendant. This is used
when there is common behavior between two use cases and
also specialized behavior specific to each use case.
43
Generalization relationship between actors
44
Applying relationship on use case
Child use
case
Parent use
case
45
Class Diagram
46
Class Diagram
47
Class Diagram
48
Class Diagram
49
Class Diagram
50
Class Diagram
51
Class Diagram
52
Class Diagram
53
Class Diagram
54
Class Diagram
55
Class Diagram
56
Class Diagram
57
Class Diagram
58
Class Diagram
59
Class Diagram
Student can
choose more
than one course
60
Class Diagram
Multiplicity
A store can have
multiple items
Or multiple items
can be in one store
61
Class Diagram
Multiplicity
62
Class Diagram
Multiplicity
63
Class Diagram
64
Class Diagram
65
Class Diagram
66
Class Diagram
67
Class Diagram
68
Class Diagram
69
Class Diagram
70
Class Diagram
71
Class Diagram
72
Class Diagram
73
Class Diagram
74
Class Diagram
75
Class Diagram
76
Class Diagram
77
Class Diagram
78
Class Diagram
79
Class Diagram
80
Object Diagram
Structural Diagram
81
Object Diagram
Structural Diagram
(i) Objects
Objects are instances of a class. For example, if
"car" is a class, a 2007 Nissan Altima is an object
of a class.
Symbol for object
82
Object Diagram
Structural Diagram
Object Attributes:
Similar to classes, you are able to list object attributes inside a separate
compartment. However, unlike classes, object attributes should have values
assigned for them.
83
Object Diagram
Structural Diagram
(ii)Class titles
(iii) Links
Links are the lines that connect two shapes of an
object diagram to each other.
Link
85
Object Diagram
Class to Object Diagram Example - Order System
86
Object Diagram
Example 1
87
Sequence Diagram
88
Sequence Diagram
Purpose of Sequence Diagram
• Model high-level interaction between active objects in a
system
• Model the interaction between object instances within a
collaboration that realizes a use case
• Model the interaction between objects within a collaboration
that realizes an operation
• Either model generic interactions (showing all possible
paths through the interaction) or specific instances of a
interaction (showing just one path through the interaction)
89
Sequence Diagram
90
Sequence Diagram
91
Sequence Diagram
92
Sequence Diagram
It has two dimensions
The vertical axis shows the time from top
to bottom
93
Sequence Diagram Notation
Actor
• A type of role played by an entity that interacts with the subject (e.g., by
exchanging signals and data)
• external to the subject (i.e., in the sense that an instance of an actor is not
a part of the instance of its corresponding subject).
94
Sequence Diagram Notation
Lifeline
95
Sequence Diagram Notation
Activations
• The top and the bottom of the of the rectangle are aligned with the
initiation and the completion time respectively
.
96
Sequence Diagram Notation
Call Message
97
Call Message
98
Call Message
99
Sequence Diagram Notation
Return Message
100
Call Message
101
Sequence Diagram Notation
102
Sequence Diagram Notation
103
Sequence Diagram Notation
Self Message
104
Sequence Diagram Notation
Self Message
105
Sequence Diagram Notation
Recursive Message
106
Sequence Diagram Notation
Recursive Message
107
Sequence Diagram Notation
Create Message
108
Sequence Diagram Notation
109
Sequence Diagram Notation
Destroy Message
110
Sequence Diagram Notation
Duration Message
111
Sequence Diagram Notation
Duration Message
112
Sequence Diagram Notation
Note
113
Sequence Fragments
Sequence Fragments
• The fragment operator (in the top left cornet) indicates the
type of fragment
Sequence Fragments
115
Sequence Diagram
Advantages
• It is convenient to generate.
Disadvantages
• Every sequence requires several notations for their
representation, so it can make these diagrams more
complicated.
117
State Diagram
• A state diagram consists of states, transitions, events, and
activities. You use state diagrams to illustrate the dynamic view of
a system. They are especially important in modeling the behavior
of an interface, class, or collaboration.
118
State Diagram
Key Concepts of a State Machine
119
State Diagram
Key Concepts of a State Machine
Transition
A solid arrow represents the path between
different states of an object. Label the transition
with the event that triggered it and the action that
results from it. A state can have a transition that
points back to itself.
120
State Diagram
Key Concepts of a State Machine
Initial State
A filled circle followed by an arrow represents the
object's initial state.
121
State Diagram
Key Concepts of a State Machine
Final State
An arrow pointing to a filled circle nested inside
another circle represents the object's final state.
122
State Diagram
Key Concepts of a State Machine
123
State Diagram
124
State Diagram
125
Activity Diagram
126
Activity Diagram
127
Activity Diagram Notation
Activity
Is used to represent a set of actions
Action
A task to be performed
Control Flow
Shows the sequence of execution
Initial Node
Portrays the beginning of a set of
actions or activities
Merge Node
Bring back together different decision
paths that were created using a decision-
node.
Fork Node
Split behavior into a set of parallel or
concurrent flows of activities (or actions)
Join Node
Bring back together a set of parallel or
concurrent flows of activities (or actions).
129
Component Diagram
130
Component Diagram
131
Elements of component diagram
(i)Component
A component is a logical unit block of the
system, a slightly higher abstraction than
classes. It is represented as a rectangle with
a smaller rectangle in the upper right corner
with tabs or the word written above the
name of the component to help distinguish it
from a class.
132
Elements of component diagram
Component
A component is a logical unit block of the
system, a slightly higher abstraction than
classes. It is represented as a rectangle with
a smaller rectangle in the upper right corner
with tabs or the word written above the
name of the component to help distinguish it
from a class.
133
Elements of component diagram
(ii)Interface
An interface (small circle or semi-circle on a stick) describes
a group of operations used (required) or created (provided)
by components. A full circle represents an interface created
or provided by the component. A semi-circle represents a
required interface, like a person's input.
134
Elements of component diagram
(iiI) Dependencies
135
Elements of component diagram
(iiI)
Port
Ports are represented using a square along
the edge of the system or a component. A
port is often used to help expose required
and provided interfaces of a component.
136
Relationships
(i) Association:
• An association specifies a semantic relationship that can occur
between typed instances.
• It has at least two ends represented by properties, each of which is
connected to the type of the end. More than one end of the
association may have the same type.
137
Relationships
(ii) Composition:
• Composite aggregation is a strong form of aggregation
that requires a part instance be included in at most one
composite at a time.
• If a composite is deleted, all of its parts are normally
deleted with it.
138
Relationships
(ii) Composition:
•Composite aggregation is a strong form of aggregation
that requires a part instance be included in at most one
composite at a time.
•If a composite is deleted, all of its parts are normally
deleted with it.
139
Relationships
(iii) Aggregation
A kind of association that has one of its end marked shared as kind of
aggregation, meaning that it has a shared aggregation.
140
Relationships
(iv) Constraint
141
Relationships
(V) Dependency
142
Relationships
(iv) Dependency
143