Phân tích thiết kế hướng đối tượng - Chương 3.3 (HUST) GV.Phạm Ngọc Nam

LI
lienhejb
0 Downloads
47
0

Inhalt des Dokuments

Seite 1

goupee.vn TRƢỜNG ĐẠI HỌC BÁCH KHOA HÀ NỘI goupee.com KHOA ĐIỆN TỬ VIỄN THÔNG PHÂN TÍCH THIẾT KẾ HƢỚNG ĐỐI TƢỢNG CHƢƠNG 3. Phân tích Special thanks to: Trinh Tuan Cuong Le Viet Anh Lo an Tung Bộ môn Điện tử tin học fb.com/goupee.vn04/2007 CuuDuongThanCong.com https://fb.com/tailieudientucntt

Seite 2

goupee.vn goupee.com Chƣơng 3. Phân tích  3.1. Xác định rõ yêu cầu  3.2. Mô hình hóa chức năng  3.3. Mô hình hóa cấu trúc  3.4. Mô hình hóa hoạt động fb.com/goupee.vn October 20 OOD - DEI.FET.HUT 2 CuuDuongThanCong.com https://fb.com/tailieudientucntt

Seite 3

goupee.vn goupee.com 3.3. Mô hình hóa cấu trúc  Mục đích:  Sử dụng mô hình cấu trúc hay mô hình khái niệm để mô tả cấu trúc dữ liệu sử dụng trong các quy trình nghiệp vụ của tổ chức  Thu hẹp khoảng cách về ngữ nghĩa giữa thế giới thực và thế giới phần mềm  Tạo ra vốn từ vựng cho người phân tích và người sử dụng  Miêu tả vật thể ,ý tưởng và các khái niệm quan trọng của ứng dụng  Cách mô tả cấu trúc:  CRC cards, class diagrams, and object diagrams. fb.com/goupee.vn October 20 OOD - DEI.FET.HUT 3 CuuDuongThanCong.com https://fb.com/tailieudientucntt

Seite 4

goupee.vn goupee.com Các phần tử cơ bản của mô hình cấu trúc  Classes (Lớp)  Attributes (Thuộc tính)  Operations (Hành động/ phương thức)  Relationships (Quan hệ) fb.com/goupee.vn October 20 OOD - DEI.FET.HUT 4 CuuDuongThanCong.com https://fb.com/tailieudientucntt

Seite 5

goupee.vn goupee.com Classes  Các mẫu để tạo ra biểu tƣợng hoặc đối tƣợng:  Mọi đối tƣợng của cùng một lớp có cùng cấu trúc và cùng hành động nhƣng có các thuộc tính khác nhau.  Concrete (Cụ thể): được dùng để tạo ra các đối tượng thực sự  Abstract (Trừu tượng): được dùng để tạo ra các lớp khác fb.com/goupee.vn October 20 OOD - DEI.FET.HUT 5 CuuDuongThanCong.com https://fb.com/tailieudientucntt

Seite 6

goupee.vn goupee.com Attributes  Đơn vị thông tin dùng để mô tả lớp  Chỉ nên đƣa vào những thuộc tính quan trọng  Thuộc tính nên là các kiểu nguyên tố (integers, strings, doubles, date, time, boolean,…) fb.com/goupee.vn October 20 OOD - DEI.FET.HUT 6 CuuDuongThanCong.com https://fb.com/tailieudientucntt

Seite 7

goupee.vn goupee.com Operations (Services)  Hành động mà đối tƣợng có thể thi hành  Tập trung vào các hoạt động cụ thể của các vấn đề liên quan fb.com/goupee.vn October 20 OOD - DEI.FET.HUT 7 CuuDuongThanCong.com https://fb.com/tailieudientucntt

Seite 8

goupee.vnRelationships goupee.com  Tổng quát hóa (Generalization)  Kiểu quan hệ “Is-A”, “a-kind-of”  Cho phép kế thừa các thuộc tính và phương thức của một lớp  2 loại lớp: Lớp con (Subclasses) và lớp cha (superclasses)  Nguyên tắc “thay thế”  Các lớp con có thể thay thế các lớp cha  Toàn thể-bộ phận/ bao hàm (Aggregation)  Kiểu quan hệ “Has-A”, “a-part-of”, “a-member-of”  Liên kết bộ phân với toàn thể  Là quan hệ 2 chiều  Ngược với aggregation là decompsition  Các bộ phận có thể được mô hình hóa riêng biệt fb.com/goupee.vn October 20 OOD - DEI.FET.HUT 8 CuuDuongThanCong.com https://fb.com/tailieudientucntt

Seite 9

goupee.vn goupee.com Relationships  Liên kết (Association)  Các quan hệ không thuộc 2 loại trên  Thể hiện các mối quan hệ khác nhau giữa các lớp  Example:  Patient schedules an appointment  So the appointment has a patient  This is weak fb.com/goupee.vn October 20 OOD - DEI.FET.HUT 9 CuuDuongThanCong.com https://fb.com/tailieudientucntt

Seite 10

goupee.vn goupee.com Your Turn  What classes, attributes, and operations that would be required to describe the process of your own project? fb.com/goupee.vn October 20 OOD - DEI.FET.HUT 10 CuuDuongThanCong.com https://fb.com/tailieudientucntt

Seite 11

CLASS-RESPONSIBILITY- goupee.vn goupee.com COLLABORATION (CRC) CARDS  Thẻ cộng tác và trách nhiệm của lớp  Đƣợc sử dụng để mô tả  Các trách nhiệm  Các sự cộng tác Của một lớp fb.com/goupee.vn October 20 OOD - DEI.FET.HUT 11 CuuDuongThanCong.com https://fb.com/tailieudientucntt

Seite 12

goupee.vn goupee.com Responsibilities and Collaborations  Trách nhiệm (Responsibilities)  Biết (Knowing)  Things an instance must know  Normally it knows values of its attributes and its relationships  Làm (Doing)  Things an instance must be able to do  Execute its operations, call other operations fb.com/goupee.vn October 20 OOD - DEI.FET.HUT 12 CuuDuongThanCong.com https://fb.com/tailieudientucntt

Seite 13

goupee.vn goupee.com Responsibilities and Collaborations  Cộng tác (Collaboration)  Các use case liên quan đến nhiều lớp  Các đối tƣợng làm việc với nhau để phục vụ một yêu cầu  Cho phép tập trung vào Clients, Server, và Contracts fb.com/goupee.vn October 20 OOD - DEI.FET.HUT 13 CuuDuongThanCong.com https://fb.com/tailieudientucntt

Seite 14

goupee.vn goupee.com Clients, Servers, Contracts  Client  Là thể hiện của 1 lớp  Gửi các yêu cầu tới thể hiện của lớp khác  Server  Thể hiện của lớp nhận yêu cầu  Contract  Sự tương tác giữa client và server fb.com/goupee.vn October 20 OOD - DEI.FET.HUT 14 CuuDuongThanCong.com https://fb.com/tailieudientucntt

Seite 15

goupee.vn goupee.com Clients, Servers, Contracts  Example  Patient makes appointment with Doctor  Client: Patient object  Server: Doctor object  Contract: Both agree to be at a specific place at a specific time fb.com/goupee.vn October 20 OOD - DEI.FET.HUT 15 CuuDuongThanCong.com https://fb.com/tailieudientucntt

Seite 16

goupee.vn goupee.com Elements of a CRC Card  Class Name – Danh từ (Không đƣợc là danh từ riêng)  ID – Lƣu trữ và tham chiếu với yêu cầu  Description – Định nghĩa ngắn gọn  Responsibilities – Doing responsibilities  Attributes – Knowing responsibilities  Relationships  Generalization  Aggregation  Other Associations fb.com/goupee.vn October 20 OOD - DEI.FET.HUT 16 CuuDuongThanCong.com https://fb.com/tailieudientucntt

Seite 17

goupee.vnA CRC Card goupee.com fb.com/goupee.vn October 20 OOD - DEI.FET.HUT 17 CuuDuongThanCong.com https://fb.com/tailieudientucntt

Seite 18

goupee.vn goupee.com Back of CRC Card fb.com/goupee.vn October 20 OOD - DEI.FET.HUT 18 CuuDuongThanCong.com https://fb.com/tailieudientucntt

Seite 19

goupee.vnReview CRC Card goupee.com fb.com/goupee.vn October 20 OOD - DEI.FET.HUT 19 CuuDuongThanCong.com https://fb.com/tailieudientucntt

Seite 20

goupee.vn goupee.com Review of CRC Card fb.com/goupee.vn October 20 OOD - DEI.FET.HUT 20 CuuDuongThanCong.com https://fb.com/tailieudientucntt

Die ersten 20 Seiten werden angezeigt. Laden Sie das Dokument herunter, um alles zu sehen.

Kommentare (0)

Anmelden um an der Diskussion teilzunehmen

Noch keine Kommentare. Seien Sie der Erste!