一文学透设计模式

设计模式是什么?

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

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

设计模式可以分为三大类,分别是创建型模式(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种设计模式。

创建者模式

抽象工厂模式
工厂模式

相关推荐
董员外1 小时前
RAG 系统进化论(五):Corrective RAG 与 Self-RAG,让系统发现并纠正错误
人工智能·后端·设计模式
workflower4 小时前
高质量数据集的类型
人工智能·机器学习·设计模式·自然语言处理·机器人
啦啦啦啦啦zzzz17 小时前
工具:动态类工厂和用配置文件存储属性
c++·设计模式·工具·动态工厂
Nontee1 天前
设计模式:模板方法与策略,从“每个字都认识“到能说清它们在干嘛
java·数据库·设计模式
choumin1 天前
行为型模式——模板方法模式
c++·设计模式·模板方法模式·行为型模式
啦啦啦啦啦zzzz1 天前
设计模式:建造者模式
c++·设计模式·建造者模式
梓仁沐白1 天前
【Agent 设计模式】推理技术
设计模式
Kinghiee1 天前
从使用场景切入前端常见设计模式
前端·设计模式
啦啦啦啦啦zzzz2 天前
设计模式:单例模式和工厂模式
c++·单例模式·设计模式·工厂模式
小白说大模型2 天前
Python 工程化设计模式:AI 项目中的异步流水线与策略模式实战
人工智能·python·设计模式