Design Patterns - Summary

Six principles of design patterns
     1. Principle shutter: open for extensions, to modify the code to close. System expansion is no need to modify the original code, just add the code can be.
     2. Richter substitution principle (Liskov Substitution Principle LSP):
         can be used where the parent class will be able to use the sub-class alternative. LSP is inherited cornerstone multiplexed, Richter substitution principle is - to add "on-off" principle.
     3. Dependency Inversion Principle (Dependence Inversion Principle)
         is the basis of the principle of opening and closing, the specific content: programming interfaces implemented depends on the abstract class or interface without depending on the particular class, the class may be used particularly when the extended system extensions.
     4. Interface segregation principle (Interface Segregation Principle)
         using a plurality of isolated interface, is better than using a single interface, the principle is: reduce dependence, reduce coupling.
     5. Demeter (minimum principle known) (Demeter Principle)
         happened to know principles, that is to say: an entity should minimize the interaction between the entity and the other, such that the independent function modules.
     6. Synthesis of multiplexing principles (Composite Reuse Principle)
         principle is to use the synthetic polymeric info / instead of inheritance.
    
     ? ? ?
     Design patterns are divided into three categories:
         to create a schema, a total of five categories: factory method pattern, abstract factory pattern, singleton, the builder pattern, prototype model.
             - Business scenario problem is not enough! ! We need practical application! ! ! ! Looking
        
         structural model, a total of seven kinds: adapter mode, decorative mode, proxy mode, the appearance mode, bridge mode, combination mode, Flyweight.
             -
            
         behavioral patterns, a total of eleven kinds: Strategy pattern, the template method pattern, observer mode, iterator pattern, the responsibility chain mode, command mode, the memo mode
                 state mode, the visitor pattern, intermediary model to explain the mode .
             -

           
================================================== ==============
proxy mode: this is not very clear on the specific use, it is estimated that differentiate the business:? ?
     Proxy Mode and decorative patterns are very similar, and even the code is similar. The main difference between the two is: proxy mode, the proxy class has control over the object being proxied, or fails to implement its decision.
The decorative pattern, decoration proxy objects no control over, only for an additional layer of decoration, decoration objects to enhance the functionality, nothing more.

Guess you like

Origin www.cnblogs.com/macro-renzhansheng/p/12568973.html