Design Pattern 7 Principles Summary

Source: Internet
Author: User


Object-oriented design principles and design patterns are also guidelines for the rational reconfiguration of the system, increasing our application maintainability and reusability Common object-oriented design principles include 7, these principles are not isolated, they depend on each other and complement each other. But keep in mind: "The open and closed principle is the goal, the Richter substitution principle is the basis, relies on the reversal principle is the means ", they complement each other, complement each other, below with a picture illustrates:

1. Single Responsibility PRINCIPLE,SRP: Classes have a single responsibility and cannot put too much responsibility in one class. (High cohesion, low coupling)

2. "Opening and closing principle " (Open-closedprinciple, OCP): Open for expansion, closed for modification ( core principles of design mode )

3. " Richter Substitution Principle " (Liskov Substitution Principle, LSP): Where any base class can occur, subclasses can also appear ( base )

4. " Dependency reversal Principle " (Dependence inversion Principle, DIP): Rely on abstraction rather than on specific implementations. Interface Programming ( means )

5. "Interface Isolation principle" (Interface segregation Principle, ISP): use multiple specialized interfaces instead of a single total interface, that is, the client should not rely on interfaces that it does not need.

6 ". Synthesis/Aggregation multiplexing principle" (Composite/aggregate reuseprinciple, CARP): To use object combinations as much as possible, rather than to achieve software reuse for inheritance relationships

7. "Law of Demeter,lod": Classes in the system, try not to Dimitri with other classes, reduce the degree of coupling between classes

Design pattern learning can refer to http://blog.csdn.net/lovelion/article/details/17517213

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Design Pattern 7 Principles Summary

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.