随笔分类 -  Design Patterns Learning

设计模式之桥接模式
摘要:Bridge Pattern Use the Bridge Pattern to vary not only you rimplementations, but also your abstractions. 模式类图 桥接模式包含如下角色: • Abstraction:抽象类 • RefinedA 阅读全文
posted @ 2019-11-21 18:02 低调的小郭 阅读(395) 评论(0) 推荐(0)
设计模式原则之里氏替换原则
摘要:里氏替换原则【Liskov Substitution Principle】 定义1:如果对每一个类型为 T1的对象 o1,都有类型为 T2 的对象o2,使得以 T1定义的所有程序 P 在所有的对象 o1 都代换成 o2 时,程序 P 的行为没有发生变化,那么类型 T2 是类型 T1 的子类型。(If 阅读全文
posted @ 2019-10-21 23:46 低调的小郭 阅读(516) 评论(0) 推荐(0)
设计模式原则之依赖倒置原则
摘要:依赖倒置原则 依赖倒置原则(Dependence Inversion Principle,简称DIP) 依赖倒置原则的原始定义是:High level modules should not depend upon low level modules. Both should depend upon 阅读全文
posted @ 2019-10-21 00:08 低调的小郭 阅读(167) 评论(0) 推荐(0)
设计模式原则之接口隔离原则
摘要:接口隔离原则 1.什么是接口隔离原则 Clients should not be forced to depend upon interfaces that they don't use.(客户端不应该强行依赖它不需要的接口) The dependency of one class to anoth 阅读全文
posted @ 2019-10-19 22:18 低调的小郭 阅读(275) 评论(0) 推荐(0)
设计模式原则之单一职责原则
摘要:单一职责原则(SRP:The Single Responsibility Principle) 一个类应该有且只有一个变化的原因。 There should never be more than one reason for a class to change. 为什么将不同的职责分离到单独的类中是 阅读全文
posted @ 2019-10-19 15:48 低调的小郭 阅读(202) 评论(0) 推荐(0)
设计模式学习之策略模式
摘要:策略模式(Strategy Pattern)是一种比较简单的模式,也叫做政策模式(Policy Pattern)。 其定义如下 Define a family of algorithms,encapsulate each one, and make them interchangeable(定义一组 阅读全文
posted @ 2019-10-11 17:23 低调的小郭 阅读(221) 评论(0) 推荐(0)