Introduction to design Patterns and resources

Source: Internet
Author: User

Design patterns are just a code tool for changing, adding, querying, and managing when building large projects, and it is not necessary to use design patterns alone for design patterns to complicate simple things.

In general, the design pattern is divided into three main categories: 1. Create a pattern with a total of five----create new things----hide the way you create logic while creating objects, rather than instantiating objects directly with new operators
Single-Case mode
Factory mode
Abstract Factory mode
Builder mode
Prototype mode
2. Structured mode, total seven kinds of----existing things and combinations----focus on the combination of classes and objects, and the concept of inheritance is used to combine interfaces and define how the combined objects acquire new functionality
      Adapter mode
Adorner mode
Proxy mode
Appearance mode
Bridging mode
Combination mode
Enjoy meta mode
3. Behavioral patterns, a total of 11----existing things plus emotions----focus on communication between objects
      Policy mode
Template method Mode
Observer pattern
Iterative sub-pattern
Responsibility chain Model
Command mode
Memo Mode
State mode
Visitor mode
Broker mode
Interpreter mode

The six principles of the 
 design pattern 1. Open Close Principle----extensible and non-change principle is to say to the expansion of opening, the modification is closed. When the program needs to expand, can not modify the original code, to achieve a hot plug effect. So a nutshell is: In order to make the program good extensibility, easy to maintain and upgrade. To achieve such an effect, we need to use interfaces and abstract classes, which we will refer to in the next specific design 2. The principle of substitution of the Richter scale (Liskov Substitution Principle)----One of the basic principles of object-oriented design of the Deffory substitution principle (Liskov Substitution Principle LSP). The Richter substitution principle says that where any base class can appear, subclasses must be able to appear. LSP is the cornerstone of inheritance reuse, only if the derived class can replace the base class, the function of the Software unit is not affected, the base class can be really reused, and the derived class can also add new behavior on the basis of the base class. The principle of substitution on the Richter scale is a supplement to the principle of "open-closed". The key step in implementing the "open-close" principle is abstraction. The inheritance of the base class and subclass is the concrete implementation of abstraction, so the principle of the substitution of the Richter scale is the specification of the concrete steps to realize the abstraction. --from Baidu Encyclopedia 3. The dependency reversal principle (dependence inversion Principle)----attention function does not pay attention to the realization of this is the basis of the open and close principle, specific content: TRUE interface programming, relying on abstraction and not dependent on the specific. 4. The interface isolation principle (Interface segregation Principle)----function to refine this principle means that using multiple isolated interfaces is better than using a single interface. or a reduction of the coupling between the class meaning, from here we see, in fact, the design pattern is a software design ideas, from the large software architecture, in order to upgrade and maintenance convenience. So there are multiple occurrences: reducing dependency and reducing coupling. 5. The Dimitri rule (least known principle) (Demeter Principle)----To solve why it is called the least known principle, that is to say: an entity should be as small as possible interaction with other entities, so that the system function module is relatively independent. 6. The principle of synthetic multiplexing (Composite reuse Principle)----The principle of disassembly is to use composition/aggregation as much as possible, rather than using inheritance. 
Resources Link:
1. Https://github.com/TIGERB/easy-tips
2. Http://laravelacademy.org/resources/design-patterns
3. http://designpatternsphp-zh-cn.readthedocs.io/zh_CN/latest/

Introduction to design Patterns and resources

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.