Professional Documents
Culture Documents
03 StaticAnalysis
03 StaticAnalysis
Static Analysis
Assoc. Prof. TRAN Minh Triet
Department of Software Engineering
Reference
2
Revision: Object Oriented Programming
Notations
Attributes
Methods
3
Visibility: Public/Protected/Private
+ public attributes/methods
# protected attributes/methods
- Private attributes/methods
Class
- privateAttribute
# protectedAttribute
Private
+publicOp()
# protectedOp()
- privateOp() Protected
Public
4
Scope
❖ Number of instances
Class
- classifierScopeAttribute
- instanceScopeAttribute
classifierScopeOperation()
instanceScopeOperation()
5
Example
Student
- name
- address
- studentID
- nextAvailID : int
6
Hints
7
Example
CHinhVe
# int MaLoaiHinhVe
+ float DienTich()
+ float ChuVi()
+ void Ve()
+ ...
❖ Generalization
ClassA
ClassB
ClassB inherits ClassA
ClassB is a special case of ClassA
ClassA is a general case of ClassB
9
Relationships between classes
❖ Association
ClassA ClassB
10
Relationships between classes
❖ Aggregation
ClassA ClassB
11
Relationships between classes
❖ Composition
ClassA ClassB
12
Relationships between classes
ClassA ClassB
13
Relationships between classes
Semantic?
Example:
▪ 1
▪ 2
▪ 1..*
▪ 0..*
▪ *
▪ 1, 3, 5..9
14
Relationships between classes
❖ Dependency
ClassA ClassB
16
List of class candidates
Life cycle:
Relative independence
…
❖ Hints:
People
Thing
Organization
Place
Time
Concept…
17
List of class candidates
Proposed class
Irrelavent Relavent
18
Example
19
Example
❖ Relavent/irrelavent?
Student Management System:
20
Example
21
List of possible relationships
❖ Criteria
Verb
classes
❖ Hints:
Current/temporary relationship
22
How to develop a class diagram?
23
How to develop a class diagram?
❖ Step 3:
3.1. Multiple classes with similarities (common
24
How to develop a class diagram?
❖ Step 4:
Modify relationships between classes
❖ Step 5:
Refine the class diagram (personal experience required)
25