Professional Documents
Culture Documents
Bai 12
Bai 12
Mục đích
Bộ môn Công nghệ Phần mềm Mô tả khung nhìn tĩnh của hệ thống và cách
Viện CNTT & TT đưa nó vào trong một mô hình.
Trường Đại học Bách Khoa Hà Nội Minh họa cách đọc và hiểu một biểu đồ lớp.
Mô hình hóa mối liên kết (association) và kết
tập (aggregation) và chỉ ra cách mô hình
LẬP TRÌNH HƯỚNG ĐỐI TƯỢNG chúng vào biểu đồ lớp.
Bài 12. Biểu đồ lớp Mô hình tổng quát hóa (generalization) trên
một biểu đồ lớp.
3 4
Class_Name
attribute1
attribute2
attribute3
method1()
method2()
method3()
5 6
1
8/24/2011
private
public protected
7 8
Class1
- privateAttribute
+ publicAttribute
# protectedAttribute
- privateOperation ()
+ publicOPeration () Class1
# protecteOperation ()
- classifierScopeAttr
- instanceScopeAttr
+ classifierScopeOp ()
+ instanceScopeOp ()
9 10
Student
- name
- address
- studentID
- nextAvailID : int
11 12
2
8/24/2011
Registration
CloseRegistrationForm CloseRegistrationController
University
Artifacts
RegisterForCoursesForm RegistrationController
15 16
1. Biểu đồ lớp (Class diagram) Mối liên hệ ngữ nghĩa giữa hai hay nhiều lớp
17 18
3
8/24/2011
Zero or More *
0..1
3. Kết tập (Aggregation)
4. Tổng quát hóa (Generalization)
0..1
1 0..*
Student Schedule CourseOffering
0..* 0..4
21 22
0..1
0..1
1 0..*
Student Schedule CourseOffering
Whole 1 Part 0..* 0..4
0..1
23 24
4
8/24/2011
Whole Part
Whole Part
Composition 25 26
27 28
1. Biểu đồ lớp (Class diagram) Là mối liên hệ “là một loại” (“is a kind of”)
29 30
5
8/24/2011
Ancestor
Account
- balance
Superclass - name
Discriminator Animal Abstract class - number
(parent)
+ communicate () Abstract operation + withdraw()
+ createStatement() Generalization
Communication There are no direct instances of Animal Relationship
FlyingThing Animal
Multiple Inheritance
OO Principle:
Encapsulation
Remote Control
33 34
Animal
+ communicate ()
Lion Tiger
+ communicate () + communicate ()