COMPS356 T02 - Unit1 2
COMPS356 T02 - Unit1 2
Project Management
Introduction to Software Engineering
and UML (part 2)
Hong Kong Metropolitan University
Autumn 2024/25
Presentation
1
Tutorial Group 2
Unit 1
Introduction to Software
Engineering and UML
(Part #2)
2
U
Unit 1
COMPS356
Introduction to Software
Engineering and UML
3
1.6 Use Case
Diagram
4
Unit: 1.6
5
Unit: 1.6
6
Unit: 1.6
FieldOfficer
Dispatcher
o ReportEmergency
o OpenIncident
o AllocateResource
What is Use
Case Actor communicates
with use case
Use Case
Description
#2
Use Case
Description
#3
Use Case Template
8
Unit: 1.6
Emphasize
the use of Participating Actors Flow of Events
Actors that are interacting with Describes the sequences of
natural the use case interactions of the use case
which are to be numbered for
language reference
I
UML Use Case Diagram:
Scenario Template
I
UML Use Case Diagram:
Scenario Template
I
UML Use Case
Diagram: Scenario
Template
Discussion :
Bank ATM
What is Use
Case
Diagram?
14
Unit: 1.6
15
Unit: 1.6 include
Used for reducing the
I
Communication complexity by identifying
UML Use Case commonalities in different use
cases (repeated functions)
Diagram: Actor and use case communicates
when information is exchanged The ViewMap use case is used
1. Solid Line: Represents a direct association between an actor and a use case. In the diagram, the "Actor" has a
direct association with "Use Case A" using a solid line.
2. Dotted Line: Represents relationships like "include" or "extend" between use cases. In the diagram, "Use Case
A" includes or extends "Use Case B" using a dotted line.
3. Generalization (Solid Line with Hollow Triangle Arrowhead): Represents a generalization or inheritance
relationship between use cases. In the diagram, "Use Case C" is a specialized form of "Use Case A" using a
generalization arrow.
17
Unit: 1.6
Relationships
Include
The "Login" use case is included in the
"Browse Products" use case. This
means that every time a customer
browses products, they must first log
in.
Extend
The "Apply Discount" use case extends
the "Purchase Product" use case. This
means that under certain conditions, a
discount can be applied during the
purchase process.
Use Cases
Inheritance (Generalization) Actors
• Browse Products
The "Manage Electronics" use case is a Customer
specialized form of the "Manage • Purchase Product
Admin
Inventory" use case. This relationship
• Apply Discount
is represented by a solid line with a
hollow triangle arrowhead pointing to • Login
the more general use case.
• Manage Inventory
18
• Manage Electronics
Unit: 1.6
I
UML Use Case
Diagram: Summary
Function Models: Utilized in the template form for use case diagrams
and their accompanying descriptions.
20
Unit: 1.7
I Class Diagrams
Show the structure of a system
21
Unit: 1.7
I Class Diagrams:
3 Compartments
FieldOfficer Class Name
Class name
name : string
Attributes
Attributes with data type badgeNumber : integer
22
Unit: 1.7
I Class Diagrams:
3 Compartments All of them are valid
FieldOfficer
Attributes and Operations name : string FieldOfficer
badgeNumber : integer
can be omitted for name : string
submitReport() badgeNumber : integer
simplicity
FieldOfficer
FieldOfficer
submitReport()
23
Unit: 1.7
alice:FieldOfficer separator
24
Unit: 1.7
I Class Diagrams: 1
EmergencyReport Incident
Association - Example reportsGenerated
*
1..*
reports
incidentsGenerated
*
Multiplicity is the set of integer values indicating the Role is the meaning of the association between the
number of links that can legitimately originated connecting classes
The set of integer values can be of any kind (e.g. prime It is optional
numbers) but normally fell into 3 categories Example
o One-to-one: 1 at both ends o FieldOfficer is the author of EmergencyReport
o One-to-many: 1 at one end while 0..n, 1..n or * at the other o EmergencyReport are reportsGenerated of FieldOfficer
o Many-to-many: 0..n, 1..n or * at both ends
25
Unit: 1.7
+doSomething()
- myB
ClassB
+actionB()
Person has-a
Address ClassA ClassB
(ClassA) (ClassB)
- myB : ClassB
Person Address
27
Unit: 1.7
I
Class Diagrams
(Association): Unary
Association: Aggregation
i.e. whole-part relationship
Pool Slide
(ClassA) (ClassB)
28
Unit: 1.7
I
Class Diagrams
(Association): Unary
Association: Composition
i.e. whole-part relationship
Company Department
Composition where the
lifecycle of the part class
depends on that of the whole A department is part of a company. The
class construction and destruction of a
department depends on the company
29
Unit: 1.7
I
Class Diagrams
(Associations):
Binary Association
ClassC ClassD
I Class Diagrams:
Inheritance
31
Unit: 1.7
M
Class Diagrams
(Associations):
Multiplicity
0 .. 1 an optional instance (zero or one)
n exactly n instances
n .. m n to m instances
32
Unit: 1.7
M
Class Diagrams
(Associations):
Multiplicity –
composition
1
Kitchen
inheritance
Example – when
1
designing a house
House Bath Room
1 .. *
aggregation
independent
Bedroom
0 .. 1
Mailbox
associated
but not part of the house
33
Unit: 1.7
I Class Diagrams:
More OO terms
34
Unit: 1.7
I Class Diagrams:
Summary Class Diagrams is used for describing the structure of
the system
During analysis, Class Diagrams is used for formalizing
the application domain, i.e. the scope and boundary
of the system
The result of analysis is the analysis model
Summary Detail implementation is not the focus in analysis and
Class Diagrams will be used in later stages again
35
1.8 Interaction
Diagrams
36
Unit: 1.8
IInteraction
Diagrams
Show the interaction between the objects,
mostly for a particular use case
I
Interaction
Diagrams:
Interaction between objects are arranged
Sequence Diagram
horizontally and time vertically
Messages represented by horizontal headed
arrows
Actor may appear on the sequence diagram
What is Lifeline is the dotted line showing the life time of
Sequence an object
Diagram? Activations are represented by tall thin rectangles
38
Unit: 1.8
I
Interaction
Diagrams:
Sequence Diagram
What is
Sequence
Diagram?
39
Unit: 1.7
I Interaction Diagrams:
Sequence Diagram
conditional notations
Condition is presented
by square brackets, for
example, [i>0], [i<=1],
etc.
Repetition is presented
by an asterisk: * 40
Unit: 1.7
I Interaction Diagrams:
Object creation and
destruction
Object destruction
represented by a cross
41
Unit: 1.7
I Interaction Diagrams:
Time Constraint
Specify time
constraint
between the
message sent by
a notes
42
Unit: 1.7
No constraint on
arranging the message
sent horizontally and
time sequence
vertically 43
Unit: 1.8
Discussion :
What are the pros and cons
between sequence diagram and
communication diagram?
45
Unit: 1.7
Strengths Strengths
clearly shows Space economical—
sequence or time flexibility to add
ordering of messages new objects in two
Sequence with large set of dimensions Communic
detailed notation
Diagram ation
options
Weakness Weakness Diagram
forced to extend to more difficult to see
the right when sequence of
adding new objects; messages with
consumes horizontal fewer notation
space options
46
1.9 State Machine
Diagrams
47
Unit: 1.9
I
A transition represented by an arrow
UML: State
Solid dark circle represents initial state
Machine
Diagrams Circle surrounds a dark circle represents final state
48
Unit: 1.9
I State Machine
Diagrams: actions
Actions are small atomic behaviors executed in a short period of time
There are actions within a state
Action occurs in the following situations:
o Transition (including internal transition)
o A state is entered
o A state is exited
A ‘do’ event is within a state which causes the corresponding action
to perform repeatedly
50
Unit: 1.9
I
Refi n e d S tate M a c h in e D ia g ra m s wit h
State Machine Diagrams: a c ti o n s w it h in a state
internal transition vs self
transition
pressButton1/blink next
number is an internal
transition, the event
pressButton1 caused the
action blink next number but
does not change the state of
the object
self transition will not change
the state of the object as well
but the exit and enter events
will be triggered as well
51
Unit: 1.9
52
Unit: 1.9
I State Machine
Diagrams
54
Unit: 1.10
I UML: Activity
Diagrams
55
Unit: 1.10
I Activity Diagrams:
action state
I Activity Diagrams:
decision
Swimlanes
Actions maybe grouped into swimlanes to denote the object or
subsystem implementing the actions
Represented by rectangles
Transition may across swimlanes 58
Unit: 1.10
I Activity Diagrams
61
Unit: 1.10
I Diagram Organization:
Package
63
Unit: 1.10
I Diagram Organization:
Package
64
Unit: 1.10
I Diagram
Extensions Stereotype is used for extending the meaning of
a modeling element as a classifier
o <<include>> in use case diagram
65
66