1. Trang chủ
  2. » Giáo Dục - Đào Tạo

Bài Giảng PHÂN TÍCH THIẾT KẾ HƯỚNG ĐỐI TƯỢNG

49 264 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

TRƯỜNG ĐẠI HỌC BÁCH KHOA HÀ NỘI VIỆN ĐIỆN TỬ VIỄN THÔNG PHÂN TÍCH THIẾT KẾ HƯỚNG ĐỐI TƯỢNG CHƯƠNG Phân tích (tiếp) Chương Phân tích     3.1 Xác định rõ yêu cầu 3.2 Mô hình hóa chức 3.3 Mô hình hóa cấu trúc 3.4 Mô hình hóa hoạt động Aug 25, 2017 OOD - DEI.FET.HUT 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 liệu sử dụng quy trình nghiệp vụ tổ chức  Thu hẹp khoảng cách ngữ nghĩa giới thực giới phần mềm  Tạo vốn từ vựng cho người phân tích người sử dụng  Miêu tả vật thể, ý tưởng khái niệm quan trọng ứng dụng  Cách mô tả cấu trúc:  CRC cards, class diagrams, and object diagrams Aug 25, 2017 OOD - DEI.FET.HUT Các phần tử 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ệ) Aug 25, 2017 OOD - DEI.FET.HUT Classes  Các mẫu để tạo biểu tượng đối tượng:  Mọi đối tượng lớp có cấu trúc hành động thuộc tính co gia tri khác  Concrete (Cụ thể): dùng để tạo đối tượng thực  Abstract (Trừu tượng): dùng để tạo lớp khác Aug 25, 2017 OOD - DEI.FET.HUT Attributes  Đơn vị thông tin dùng để mô tả lớp  Chỉ nên đưa vào thuộc tính quan trọng  Thuộc tính nên kiểu nguyên tố (integer, string, double, date, time, boolean,…) Aug 25, 2017 OOD - DEI.FET.HUT Operations (Services)  Hành động mà đối tượng thi hành  Tập trung vào hoạt động cụ thể vấn đề liên quan Aug 25, 2017 OOD - DEI.FET.HUT Relationships  Tổng quát hóa (Generalization)     Kiểu quan hệ “Is-A”, “a-kind-of” Cho phép kế thừa thuộc tính phương thức lớp loại lớp: Lớp (Subclasses) lớp cha (superclasses) Nguyên tắc “thay thế”  Các lớp thay 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 phân với toàn thể  Là quan hệ chiều  Ngược với aggregation decompsition  Các phận mô hình hóa riêng biệt Aug 25, 2017 OOD - DEI.FET.HUT Relationships  Liên kết (Association)  Các quan hệ không thuộc loại  Thể mối quan hệ khác lớp  Example:  Patient schedules an appointment  So the appointment has a patient  This is weak Aug 25, 2017 OOD - DEI.FET.HUT Your Turn  What classes, attributes, and operations that would be required to describe the process of your own project? Aug 25, 2017 OOD - DEI.FET.HUT 10 Nhận diện đối tượng  phương pháp phổ biến:  Phân tích nguyên văn  Danh sách đối tượng phổ biến  Sử dụng mẫu Aug 25, 2017 OOD - DEI.FET.HUT 35 Object Identification  Phân tích thông tin use-case (sử dụng use case description)    Nhận diện lớp thông qua danh từ Nhận diện phương thức thông qua động từ Quá đơn giản bước chỉnh sửa sơ đồ cấu trúc (Simplistic but good for first rough cut)  Danh sách đối tượng phổ biến  Vật tự nhiên hữu hình  Biến cố (Incidents)  Vai trò (Roles)  Các mẫu  Dùng để nhóm lớp xuất tình khác Aug 25, 2017 OOD - DEI.FET.HUT 36 Steps for Object Identification and Structural Modeling 1.Tạo CRC cards việc thực phân tích nguyên văn usecase Nếu dùng phương pháp danh sách đối tượng phổ biến: Cần tìm thêm vào lớp, thuộc tính, phương thức, quan hệ Sử dụng CRC cards “Phân vai” cho use-case Vẽ sơ đồ lớp dựa CRC cards Xem lại mô hình cấu trúc để phát lớp, thuộc tính, phương thức, quan hệ thiếu không cần thiết Kết hợp mẫu hữu ích Duyệt lại mô hình cấu trúc Aug 25, 2017 OOD - DEI.FET.HUT 37 Application Example: Step Create CRC cards by performing textual analysis on the use-cases Textual Analysis: Nouns suggest classes Aug 25, 2017 OOD - DEI.FET.HUT 39 Step Create CRC cards by performing textual analysis on the use-cases Textual Analysis: Nouns suggest classes • Textual Analysis Results: Identified potential classes  Customer  Search Request  CD  CD List  Review (i.e., CD review information) If further analyse the Maintain Order and Checkout use cases, further potential classes will be identified such as  Order  Order Item  Credit card centre  etc Aug 25, 2017 OOD - DEI.FET.HUT 40 Step Create CRC cards by performing textual analysis on the use-cases Textual Analysis: Verbs suggest operations: • For each identified class, check the related verbs to identify the operations as well as the relationships with other classes Aug 25, 2017 OOD - DEI.FET.HUT 41 Step Create CRC cards by performing textual analysis on the use-cases Textual Analysis: Verbs suggest operations: • Textual Analysis Result: For Customer Class, the identified operations (i.e., Responsibilities) and the relationship with other classes (i.e., Collaborators) are Make Search Place Order request Get Credit Card Search request Order Credit Card Centre Info Exit Select CD for Info CD List Not include as it can be included in Search request This forms the front of “Customer class” CRC Card Aug 25, 2017 OOD - DEI.FET.HUT 42 Step Create CRC cards by performing textual analysis on the use-cases • Textual Analysis Result: Combine “nouns and verbs” analysis, the back of “Customer class” CRC Card can be Order; Search request; Credit Card Centre Aug 25, 2017 OOD - DEI.FET.HUT 43 Step and Examine Common Object Lists and Role-play the CRC Cards Brainstorm additional candidate classes, attributes, operations, and relationships by using the common object list approach Role-play each use-case using the CRC cards Possible outcomes: Search request class need having sub-classes: Title Search, Artist Search and Category Search Aug 25, 2017 OOD - DEI.FET.HUT 44 Step Create the Class Diagram based on the CRC Cards • Exercise Suppose the CRC card of Customer class is given as before, create the class diagram based on it • For customer class, assume that all attributes are private type whereas all operations are public type • For other associate classes, only the class names and the relationships with the customer class need to be given Aug 25, 2017 OOD - DEI.FET.HUT 45 Class name: Customer Make Search Place Order request Get Credit Card Search request Order Credit Card Centre Info Exit Select CD for Info CD List Not include as it can be included in Search request Aug 25, 2017 OOD - DEI.FET.HUT 46 Step Create the Class Diagram based on the CRC Cards • Solution: Credit Card Centre Order Customer * Check -> * -First name -Middle initial -Last name -…… +Make search req() +Place order() +Get credit info() +Exit() * Aug 25, 2017 * place -> Search Reg * Make -> OOD - DEI.FET.HUT 47 Step 5, and 7: Review Classes Diagrams, Incorporate Patterns, and Review the Model Review the class diagrams and structural model for any missing and/or redundancy Incorporate useful patterns • One possible pattern Review the structural model Aug 25, 2017 OOD - DEI.FET.HUT 48 Summary  CRC cards capture the essential elements of a class  Class and object diagrams show the underlying structure of an object-oriented system  Constructing the structural model is an iterative process involving: textual analysis, brainstorming objects, role playing, creating the diagrams, and incorporating useful patterns Aug 25, 2017 OOD - DEI.FET.HUT 49

Ngày đăng: 25/08/2017, 08:34

Xem thêm: Bài Giảng PHÂN TÍCH THIẾT KẾ HƯỚNG ĐỐI TƯỢNG

TỪ KHÓA LIÊN QUAN

Mục lục

    PHÂN TÍCH THIẾT KẾ HƯỚNG ĐỐI TƯỢNG

    3.3. Mô hình hóa cấu trúc

    Các phần tử cơ bản của mô hình cấu trúc

    Elements of a CRC Card

    Back of CRC Card

    Review of CRC Card

    An Example of Class Diagram

    Đơn giản hóa sơ đồ lớp

    CREATING CRC CARDS AND CLASS DIAGRAMS

    Nhận diện đối tượng

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN