Six principles of design patterns

1. Single Responsibility Principle (Single Responsibility Principle) SRP

A class is only responsible for the corresponding responsibilities in one functional area, or can be defined as: For a class, there should be only one reason for it to change

 

2. Open Close Principle (OCP)

A software entity should be open for extension and closed for modification. That is, software entities should try their best to expand without modifying the original code.

 

3. Liskov Substitution Principle LSP

All references to the base (parent) class must transparently use objects of its subclasses

 

4. Dependency Inversion Principle (Dependency Inversion Principle) DIP

Abstractions should not depend on details, and details should depend on abstractions. In other words, program for the interface, not for the implementation

 

5. Interface Segregation Principle (ISP)

Use multiple specialized interfaces instead of a single general interface, i.e. the client should not depend on those interfaces it does not need

 

6. Law of Demeter LOD

A software entity should interact as little as possible with other entities

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324817688&siteId=291194637