Design Pattern 6 Principles Summary

Source: Internet
Author: User
Single Responsibility principle definition: Do not have more than one cause of class changes. In layman's terms, a class is responsible for only one responsibility. Richter replacement Principle Definition 1: If for each object of type T1, there is an object O2 of type T2, so that all program P defined by T1 is replaced with O1 for all objects O2, the behavior of program p does not change, then type T2 is a subtype of type T1. Definition 2: All references to base classes must be able to transparently use objects of their subclasses. In other words, a subclass can appear where any base class can appear. The principle of the Richter substitution is popular: Subclasses can extend the functionality of the parent class, but cannot change the original functionality of the parent class. It contains the following 4 levels of meaning: 1). Subclasses can implement the abstract methods of the parent class, but cannot override the non-abstract methods of the parent class. 2). Subclasses can add their own unique methods. 3). When a method of a subclass overloads a method of the parent class, the method's preconditions (that is, the parameter of the method) are more lenient than the input parameters of the parent class method. 4). When a method of a subclass implements an abstract method of the parent class, the post condition of the method (that is, the return value of the method) is more than

1. Detailed introduction to six principles in design mode

Summary: Single Responsibility Principle definition: Do not have more than one cause of class changes. In layman's terms, a class is responsible for only one responsibility. Richter replacement Principle Definition 1: If for each object of type T1, there is an object O2 of type T2, so that all program P defined by T1 is replaced with O1 for all objects O2, the behavior of program p does not change, then type T2 is a subtype of type T1. Definition 2: All references to base classes must be able to use their child transparently

2. PHP design mode--Six Principles _php Tutorial

Introduction: PHP design mode-Six principles. PHP design Pattern--six principles generally consider code that adheres to the following six principles to be extensible reusable Code: These six principles should be adhered to by any object-oriented language, to

3. PHP design mode--Simple factory _php Tutorial

Introduction: PHP design mode-Simple factory. PHP design mode-Simple factory in front of the two sections on what is the design pattern and six principles, I believe that the first two sections of the content of the design model has been a preliminary understanding, and then

4. PHP design mode--six major principles

Introduction: PHP design mode--six major principles

5. Six Principles of PHP design pattern (V): dependency inversion principle

Introduction: Six Principles of PHP design pattern (V): dependency inversion principle

6. Six Principles of PHP design pattern (vi): Dimitri Law

Introduction: Six Principles of PHP design pattern (vi): Dimitri Law

7. PHP Design Pattern Six principles

Introduction: PHP design mode-Six principles. PHP design Pattern--six principles generally consider code that adheres to the following six principles to be extensible reusable Code: These six principles should be adhered to by any object-oriented language, to

8. PHP design mode Simple Factory

Introduction: PHP design mode-Simple factory. PHP design mode-Simple factory in front of the two sections on what is the design pattern and six principles, I believe that the first two sections of the content of the design model has been a preliminary understanding, and then

9. Disorderly design mode proxy mode

Introduction: In the chaos of the decorative mode of the time given a reference article, is the comparison of decorative mode and proxy mode. Naturally, this is the problem that Onecoder needs to understand now. Let's review the design pattern. 6 Principles: Six Principles of Design pattern (citation: http://zz563143188.iteye.com/blog/1847029) 1, Open Close Principle

10. Six Principles of Design pattern (2): The principle of the Richter scale replacement

Summary: There must have been a lot of doubts about the name of this principle as I have just seen it. The reason is that the principle was first introduced in 1988 by a woman surnamed Barbara Liskov of MIT. Definition 1: If you have an object of type T1 for each O1, there are objects of type T2 O2, making T1

"Related question and answer recommendation":

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.