TAILIEUCHUNG - Bài thực hành số 06: Structural Patterns

Tạo một Project mới trên EA. Tạo sơ đồ l ớp cho 7 m ẫu Structural t ừ Pattern tích hợp sẵn trong EA. 2. Thay đổi tên lớp trong. | BÀI TẬP THỰC HÀNH Môn TKPMHDT --- Bài thực hành số 06: Structural Patterns 1. Tạo một Project mới trên EA. Tạo sơ đồ lớp cho 7 mẫu Structural từ Pattern tích hợp sẵn trong EA. 2. Thay đổi tên lớp trong các mẫu này để tạo ra những ví dụ cụ thể (như ví dụ trong GangOfFour). Hướng dẫn: Xem phần Help của EA, mục Pattern Default, change Use a Pattern Using a Pattern enables you to use items defined in the Pattern with the UML model. Using Patterns enables you to rapidly create template solutions for code structures that perform the same type of task in other situations. To use a Pattern that you have previously imported into the model, follow the steps below: 1. Open the diagram into which to add the UML Pattern. 2. Select the Resources window. 3. Expand the UML Pattern folder and find the Pattern to add. 4. Either: Right-click on the Pattern and select the Add Pattern to Diagram menu option or Drag and drop the Pattern from the Resources window onto the diagram. 5. Once the appropriate selections have been made, click on the OK button to import the Pattern into the model, recreating the original diagram with new GUIDs. Change Pattern Element Default To change the default of the Pattern element, follow the steps below: 1. From the Add Pattern dialog select the individual element in the Pattern Element panel. 2. Click on the [ . ] button to display the Edit dialog. The specific method for changing the element name is dependant upon the entry in the Action column of the Pattern Elements panel. 3. If the Action entry is Create, then in the Default field in the Edit dialog delete the existing value and type your own, user-defined value. Click on the OK button. The element default is updated on the Add Pattern dialog. 4. If the Action entry for the element is Merge, in the Edit dialog click on the [ . ] button to browse to an existing element classifier. The Set Element Classifier dialog displays. 5. Select an existing element classifier from the Classifier list. You can restrict the number of choices by selecting the elements from a specific namespace; to do this, click on the In Namespace drop-down arrow and select a namespace. For more information regarding setting element classifiers see the Using Classifiers topic. 3. Import 7 mẫu structural từ code GangOfFour vào. Lưu ý: tổ chức thành các Package riêng cho từng mẫu. Mỗi dạng (Structural, RealWorld, .NETOptimized) biểu diễn trong một lược đồ lớp riêng. 4. Mở phần code của GangOfFour trên Visual Studio, copy phần mẫu FlyWeight (RealWorld) sang một Project mới. Kết hợp Singleton vào mẫu FlyWeight này để đảm bảo chỉ tạo 1 thực thể duy nhất cho FlyWeightFactory. Import lại sơ đồ lớp cho phần code đã điều chỉnh. Quan sát kết quả xem đã phù hợp hay chưa. 5. Kết hợp FlyWeight với Composite để xử lý sao cho các LeafNodes (Primitives) được chia sẻ giữa nhiều đối tượng (phức hợp) khác nhau. Lập sơ đồ lớp cho mẫu lai này. Phát sinh code và hoàn chỉnh phần cài đặt cho ví dụ RealWorld của Composite, sau khi đã kết hợp FlyWeight. -HẾT BÀI 6-

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.