单一职责原则(Single Responsibility Principle),简称SRP。 定义: There should never be more than one reason for a class to change. 应该有且仅有一个原因引起类的变更。 有时候,开发人员设计接口的时候会有些问题,比如用户的属性和用户的行为被……
首先看看接口隔离原则的定义,有两种定义 第一种:Clients should not be forced to depend upon interfaces that they don’t use.(客户端不应该强行以来它不需要的接口) 第二种:The dependency of one class to another on……
依赖倒置原则(Dependence Inversion Principle),简称DIP 定义 High level modules should depend upon low level modules. Both should depend upon abstractions. Abstractions should not dep……
里氏置换原则(Liskov Substitution Principle),简称LSP 定义: Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing i……