
设计模式
Auraro姐姐
一起来敲代码吧
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
里式替换原则(LSP)
第一种定义: if for each object o1 of type S there is an object o2 of type T such that for all programs P defined in terms of T,the behavior of P is uchanged when o1 is substituted for o2 then S is a s...翻译 2018-09-04 09:39:08 · 331 阅读 · 0 评论 -
单一职责(SRP)
单一职责(SRP): There should never be more than one reason for a class to change. 我的理解是一个接口或者类只有一个职责,在需求变化时,需要修改这个借口或类的时候,引起的原因也只能只有一个。 不能仅仅是觉得该接口或者类确实是只在负责一个职责,而忽略掉在修改这个类的时候会因为多个需求变化进行多次修改。 例如...翻译 2018-09-03 15:36:30 · 211 阅读 · 0 评论 -
依赖倒置原则(DIP)
依赖倒置原则的原始定义: high level modules should not depend upon low level modules.Both should depend upon abstractions.Abstractions should not depend upon details.Details should depend upon abstractions. ...翻译 2018-09-06 18:14:10 · 446 阅读 · 0 评论