TAILIEUCHUNG - C# 3.0 Design Patterns PHẦN 6

Mặt tiền-mẫu-là một trong những đơn giản mà vòng ra các nhóm cấu trúc. Mục đích của mô hình này là để cung cấp một giao diện đơn giản với một tập hợp các hệ thống phức đoạn này sử dụng hai tính năng thú vị C #: khởi tạo và liệt kê các loại. | A further elaboration on the theme of creating products is that instead of the client explicitly declaring fields of type ProductA and ProductB say the Product object the builder returns is actually a list of parts which can have different lengths and contents depending on the director that was in charge at its creation. A comparison of the two patterns is given in Table 6-1. Table 6-1. Comparison of Abstract Factory and Builder patterns Criteria Abstract Factory Builder Client aggregates A Factory and Products A Director Builders and a Product Product creation is via A factory A director Product creation invokes CreateProductA Construct builder Factory Builder returns A specific product A part of a product Product has Specific properties A list of parts 138 Chapter 6 Creational Patterns Abstract Factory and Builder CHAPTER 7 Behavioral Patterns Strategy State and Template Method Behavioral patterns are concerned with algorithms and communication between them. The operations that make up a single algorithm might be split up between different classes making a complex arrangement that is difficult to manage and maintain. The behavioral patterns capture ways of expressing the division of operations between classes and optimize how the communication should be handled. In this first chapter on behavioral patterns we ll look at three simple but very useful patterns the Strategy State and Template Methods. Strategy Pattern Role The Strategy pattern involves removing an algorithm from its host class and putting it in a separate class. There may be different algorithms strategies that are applicable for a given problem. If the algorithms are all kept in the host messy code with lots of conditional statements will result. The Strategy pattern enables a client to choose which algorithm to use from a family of algorithms and gives it a simple way to access it. The algorithms can also be expressed independently of the data they are using. Illustration A classic illustration of

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.