General Responsibilities Assignment Software Mode (Grasp) focuses on basic general design procedures, is an important design principle for FURPS demand models. The GOF design pattern pays more attention to the design of the quality demand in the FURPS demand model. You can find the shadow of Grasp in GOF design mode. A personal little experience: 1. Use "Adapter Mode <- Factory Model (Create Adapter) <- Singleton Mode (Create Adapter)" when addressing an external service problem of interface changes (enabling global visible) ". 2, the algorithm and strategy problem solving changes ( Customized Business Rule) Use "Policy Mode (Define Different Algorithms to Realize the Separate Class of the Same Interface) <- Factory Model (Create Policy Object -) <- Singleton Mode (Optional)", and can join the combination mode to resolve the strategy Conflict. 3. Use the observer mode to reduce the coupling of the layer and the business layer.
Mode Name Description (Problem / Solution) Information Expert Mode: What is the general principle of object design and responsibilities? Solution: Assign your responsibilities to classes with information necessary to fulfill a responsibility - information specialist. (I.e., assign responsibilities to a class, this class must have the information you need to perform this duties.) Creator mode Question: Who should be responsible for generating an instance of the class (corresponding to the "factory model" in the GOF design mode) resolution Solution: If one or more conditions are met, the role of the category A instance is assigned to class B .. class B aggregate class A. Class B contains the object of class A. Class B record an instance of class A object. Class B closely uses the object of class A. Class B initialize the data and passes to class A when creating an instance of class A (class B is an expert in creating class A instance). In the above case, class B is the founder of class A object. Controller mode problem: Who handles a system event? Solution: When the class represents one of the following situations, the duties of the processing system event message are assigned. Represents the entire system, device or subsystem (appearance controller). The use case scenario (use case or reply controller) representing the system event. Low coupling problem: How to support low-dependent and increase reuse? Solution: The (unnecessary) coupling is kept low when assigning duties. High Callogenic Problem: How to make complexity management? Solution: The internal gather is kept at the time when allocating duties. Polymorphic mode Problem: Who is responsible for handling these changes when behavior changes? Solution: When the type change causes another behavior or causes behavioral changes, the application of polymorphism is assigned to the role of behavior to the type that causes behavioral changes. Pure fiction mode Problem: When do not destroy high-polycast and low-coupling design principles, who is responsible for handling these changes? Solution: Assign a set of high-necapThe duties to a fictional or handling "behavior" class, which is not the concept in the problem domain, but the fictional transaction to support high-internal, low coupling and The purpose of reuse. Intermediary mode Problem: How to assign responsibilities to avoid direct coupling? Solution: Assign your job to the intermediate object to coordinate the operation between components or services, so they do not directly couple. Protection Mode Problem: How to assign jobs to objects, subsystems, and systems, so that changes or unstable points in these elements do not adversely affect other elements? Solution: Find out an element that is expected to have changed or unstable, assign duties to its creation of a stable "interface".