[Java] Object-oriented principles

https://zh.wikipedia.org/wiki/SOLID_(%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1%E8%AE%BE%E8%AE%A1)

Initials Refers to concept
S Single function principle
Single function principle
I think the object should have only one single function concept.
O Principle of opening and closing
Principle of opening and closing
The concept of "software body should be open for extension, but closed for modification".
L Richter substitution principle
Richter substitution principle
The concept that "objects in the program should be replaced by its subclasses without changing the correctness of the program". Refer to  contract design .
I Interface isolation principle
Interface isolation principle
 The concept that "multiple specific client interfaces is better than one broad-purpose interface" [5] .
D Dependence reversal principle
Dependence reversal principle
It is believed that a method should follow  the concept of "depending on abstraction rather than an instance" [5] .
Dependency injection is one way to implement this principle.

Guess you like

Origin blog.csdn.net/michellechouu/article/details/48751639