一文学透设计模式

设计模式是什么?

设计模式是软件开发人员在软件开发过程中面临的一般问题的解决方案,代表了解决一些问题的最佳实践。这些解决方案是众多软件开发人员经过相当长的一段时间的试验和错误总结出来的。

说白了,设计模式对于软件开发人员来说就是武功秘籍,遇到这个情况或者这个问题的时候,跟着我这么做,准没错,就是这个意思。

设计模式可以分为三大类,分别是创建型模式(Creational Patterns)结构型模式(Structural Patterns)行为型模式(Behavioral Patterns)

每一个大类下有包含了多种设计模式。

设计模式分类 设计模式
创建型模式 工厂模式(Factory Pattern) 抽象工厂模式(Abstract Factory Pattern) 单例模式(Singleton Pattern) 建造者模式(Builder Pattern) 原型模式(Prototype Pattern)
结构型模式 适配器模式(Adapter Pattern) 桥接模式(Bridge Pattern) 组合模式(Composite Pattern) 装饰器模式(Decorator Pattern) 外观模式(Facade Pattern) 享元模式(Flyweight Pattern) 代理模式(Proxy Pattern)
行为型模式 责任链模式(Chain of Responsibility Pattern) 命令模式(Command Pattern) 解释器模式(Interpreter Pattern) 迭代器模式(Iterator Pattern) 中介者模式(Mediator Pattern) 备忘录模式(Memento Pattern) 观察者模式(Observer Pattern) 状态模式(State Pattern) 策略模式(Strategy Pattern) 模板模式(Template Pattern) 访问者模式(Visitor Pattern)

我们可以看到总共有23种设计模式,接下里,我们就要开始学习23种设计模式。

创建者模式

抽象工厂模式
工厂模式

相关推荐
yangpipi-1 小时前
2. 设计模式之结构型模式
设计模式
进击的小头5 小时前
设计模式组合应用:嵌入式通信协议栈
c语言·设计模式·策略模式
致Great5 小时前
智能体的设计模式探讨
设计模式
BD_Marathon7 小时前
设计模式——单一职责原则
设计模式·单一职责原则
stevenzqzq8 小时前
Slot API 设计模式
设计模式·compose
reddingtons8 小时前
Cascadeur:动态总是“飘”?“物理外挂流” 3分钟直出重力感 2D 立绘
游戏·设计模式·aigc·设计师·游戏策划·游戏美术·cascadeur
Wyy_9527*8 小时前
行为型设计模式——策略模式
设计模式·策略模式
kogorou0105-bit8 小时前
前端设计模式:发布订阅与依赖倒置的解耦之道
前端·设计模式·面试·状态模式
BD_Marathon8 小时前
设计模式——接口隔离原则
java·设计模式·接口隔离原则
小码过河.1 天前
设计模式——适配器模式
设计模式·适配器模式