开发者社区> 问答> 正文

SOLID包含哪些设计原则?

SOLID包含哪些设计原则?

展开
收起
罗鹏大佬 2022-04-18 17:36:11 443 0
来自:阿里技术
1 条回答
写回答
取消 提交回答
  • 1、单一职责原则:A class should have one, and only one, reason to change,一个类只能因为一个理由被修改。 2、开闭原则:Entities should be open for extension, but closed for modification,对扩展开放,对修改关闭。 3、里氏替换原则:Functions that use pointers of references to base classes must be able to use objects of derived classes without knowing it,子类可以替换父类。 4、接口隔离原则:A client should not be forced to implement an interface that it doesn’t use,不能强制客户端实现它不使用的接口,应该把接口拆的尽可能小。 5、依赖倒置原则:Abstractions should not depend on details. Details should depend on abstractions,抽象不依赖于细节,而细节依赖于抽象。

    2022-04-19 15:52:17
    赞同 展开评论 打赏
问答地址:
来源圈子
更多
收录在圈子:
+ 订阅
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载