Skip to content

mind1949/design_patterns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

Design Patterns

学习设计模式

如何看待设计模式

  • 设计模式只是解决某类问题的参考答案;
  • 要根据具体问题思考解决方案,去解决问题,而不是根据解决方案(设计模式)解决问题;
  • 只是有时自己思考得出的方案,就是某个设计模式;

消化理解的步骤

  • 解决什么问题?
  • 是我会怎么解决?
  • 该模式是怎么解决的,会有哪些好处和弊端?
  • 怎样能想到这个模式?
  • 这个模式由哪些基本技巧组织成的(例如:多态、组合等)?
  • 整理模式中自己以前不知道的基本技巧,让它变成自己解决问题的基本工具。
  • 在某个编程语言中这个如何实现这个解决方案(代码组织的结构。包括:类、函数、文件、目录等的组织方式)?

模式

创建型模式(Creational)

  • 工厂方法(Factory Method)
  • 抽象工厂(Abstract Factory)
  • 生成器(Builder)
  • 原型(Prototype)
  • 单例(Singleton)

结构型模式(Structural)

  • 适配器模式(Adapter)
  • 桥接模式(Bridge)
  • 组合模式(Composite)
  • 装饰模式(Decorator)
  • 外观模式(Facade)
  • 享元模式(Flyweight)
  • 代理模式(Proxy)

行为模式(Behavioral)

  • 责任链模式(Chain of Responsibility)
  • 命令模式(Command、Action、Transaction)
  • 迭代器模式(Iterator)
  • 中介者模式(Intermediary、Controller、Mediator)
  • 备忘录模式(Memento、Snapshot)
  • 观察者模式(Observer、Event-Subscriber、Listener)
  • 状态模式(State)
  • 策略模式(Strategy)
  • 模板方法模式(Template Method)
  • 访问者模式(Visitor)

参考资料

About

学习设计模式

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published