Presentation is loading. Please wait.

Presentation is loading. Please wait.

LECTURE 7: Object Oriented Design

Similar presentations


Presentation on theme: "LECTURE 7: Object Oriented Design"— Presentation transcript:

1 LECTURE 7: Object Oriented Design
Ivan Marsic Rutgers University

2 Topics Gán trách nhiệm cho các đối tượng Design Principles
Expert Doer High Cohesion Low Coupling Business Policies Class Diagram

3 System Sequence Diagrams
Biểu đồ tuần tự hệ thống cho usecase mở khóa select function(“unlock") : System User «initiating actor» prompt for the key enter key verify key signal: valid key, lock open open the lock, turn on the light Timer «offstage actor» start ("duration“) System Sequence Diagrams considered interactions between the actors

4 Design: Object Interactions
Sequence Diagram System Sequence Diagram System Sequence Diagram mô tả tương tác giữa các actor Object Sequence Diagram mô tả tương tác giữa các đối tượng

5 Metaphor for Software Design: “Connecting the Dots”
Ta bắt đầu từ các đối tượng/khái niệm từ pha phân tích, và sửa hoặc thêm các đối tượng mới, nhằm làm cho hệ thống hoạt động được.

6 Types of Object Responsibilities
Knowing responsibility: ghi nhớ dữ liệu hoặc tham chiếu, chẳng hạn data values, data collections, tham chiếu tới các đối tượng khác. Biểu diễn ở dạng thuộc tính Doing responsibility: thực hiện tính toán, chẳng hạn xử lý dữ liệu, điều khiển các thiết bị phần cứng,… biểu diễn dưới dạng phương thức Communicating responsibility: Liên lạc với các đối tượng khác, thể hiện ở việc gọi phương thức của đối tượng khác

7 Design: Assigning Responsibilities

8 Đặc điểm của thiết kế tốt
Chuỗi liên lạc ngắn Phân công công việc cân bằng Ít quan hệ giữa các lớp method_1() method_1() method_2() method_N()

9 Design Principles Expert Doer Principle: ai biết thông tin thì làm
High Cohesion Principle: không giữ nhiều trách nhiệm Low Coupling Principle: không giữ quá nhiều communication responsibility There are many more …

10 Cohesion

11 Class Diagram


Download ppt "LECTURE 7: Object Oriented Design"

Similar presentations


Ads by Google