Software Construction Course notes - SOLID principles of object-oriented design

Single Responsibility Principle (SRA)

A class should do one thing.
There should be no reason to change multiple classes

Open Closed Principle (OCP)

Software entity shall open for extension, but closed for modification.
That is, rather than modify the source code through inheritance, a combination of extensions

Richter Substitution Principle (LSP)

Subclasses may alternatively be a base class client code references safely

Interface Segregation Principle (ISP)

It does not force customers to rely on an interface they are not used
, ie, the interface should be as small (single interface functions)

Dependency Inversion Principle (DIP)

Advanced modules should not depend on low-level modules
Both should depend on abstractions

Abstract should not be relied on to achieve
realization reliance abstract

Guess you like

Origin blog.csdn.net/hieheihei/article/details/93382475