Skip to content

Christopher-Shi/Chris.DesignPatterns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chris.DesignPatterns

面向对象设计的三大原则

  • 哪里有变化,我就封装哪里
  • 面向抽象编程,细节和高层实现都要依赖抽象
  • 多组合,少继承

根据这三大原则又衍生出来6个具体的原则

  • 单一职责原则
  • 里氏替换原则
  • 依赖倒置原则
  • 接口隔离原则
  • 迪米特法则
  • 开闭原则

创建型:负责对象创建

C#设计模式(1)——单例模式(Singleton Pattern)Chris.DesignPatterns.Singleton
Singleton单件模式解决的是实体对象个数的问题

C#设计模式(2)——工厂方法模式(Factory Pattern)Chris.DesignPatterns.Factory

C#设计模式(3)——抽象工厂模式(Abstract Pattern)Chris.DesignPatterns.AbstractFactory

C#设计模式(4)——建造模式(Builder Pattern)Chris.DesignPatterns.Builder

C#设计模式(5)——原型模式(Prototype Pattern)Chris.DesignPatterns.Prototype

结构型:处理类与对象间的组合

C#设计模式(6)——适配器模式(Adapter Pattern)Chris.DesignPatterns.Adapter
适配器模式注重转换接口,将不吻合的接口适配对接

C#设计模式(7)——桥接模式(Bridge Pattern)Chris.DesignPatterns.Bridge
桥接模式注重分离接口与其实现,支持多维度变化

C#设计模式(8)——装饰模式(Decorator Pattern)Chris.DesignPatterns.Decorator
装饰者模式注重稳定接口,在此前提下为对象扩展功能

C#设计模式(9)——组合模式(Composite Pattern)Chris.DesignPatterns.Composite
组合模式注重统一接口,将“一对多”的关系转化为“一对一”的关系

C#设计模式(10)——外观模式(Facade Pattern)Chris.DesignPatterns.Facade
外观模式注重简化接口,简化组件系统与外部客户程序的依赖关系

C#设计模式(11)——享元模式(Flyweight Pattern)Chris.DesignPatterns.Flyweight
享元模式注重保留接口,在内部使用共享技术对对象存储进行优化

C#设计模式(12)——代理模式(Proxy Pattern)Chris.DesignPatterns.Proxy
代理模式注重假借接口,增加间接层来实现灵活控制

行为型:类与对象交互中的职责分配

C#设计模式(13)——模板方法模式(Template Method)Chris.DesignPatterns.Template

C#设计模式(14)——命令模式(Command Pattern)Chris.DesignPatterns.Command

C#设计模式(15)——迭代器模式(Iterator Pattern)Chris.DesignPatterns.Iterator

C#设计模式(16)——观察者模式(Observer Pattern)Chris.DesignPatterns.Observer

C#设计模式(17)——中介者模式(Mediator Pattern)Chris.DesignPatterns.Mediator

C#设计模式(18)——状态模式(State Pattern)Chris.DesignPatterns.State

C#设计模式(19)——策略模式(Strategy Pattern)Chris.DesignPatterns.Strategy

C#设计模式(20)——责任链模式(Chain of Responsibility Pattern)Chris.DesignPatterns.ChainOfResponsibility

C#设计模式(21)——访问者模式(Visitor Pattern)Chris.DesignPatterns.Visitor

C#设计模式(22)——备忘录模式(Memento Pattern)Chris.DesignPatterns.Memento

C#设计模式(23)——解释器模式(Interpreter Pattern)Chris.DesignPatterns.Interpreter

About

Chris.DesignPatterns

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages