---
title: "设计模式没时间学？(一图带你搞定23种设计模式)"
description: "分享Jason McDonald整理的23种设计模式速查卡，按创建型、结构型、行为型分类，每个模式配一张UML图便于快速回顾记忆，文末附原版PDF下载地址。"
date: 2020-03-14T16:00:00Z
canonical: https://xiaobox.github.io/p/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/
author: 小盒子
categories: ["架构与方法"]
tags: ["设计模式", "面试"]
source: https://mp.weixin.qq.com/s/AqY6KjTL1EG7fvWD8kDgNA
license: CC BY-NC-SA 4.0
license_url: https://creativecommons.org/licenses/by-nc-sa/4.0/
---

# 设计模式没时间学？(一图带你搞定23种设计模式)

**设计模式学完容易忘?
**

**设计新东西时，不知道用哪个？
**

**知道用哪个模式又开始手忙脚乱的一通查？**

**面试让画个设计模式的UML图拉了胯？**

你碰到的问题很多人都有![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/001-cbf3152b.png)

早在2007年国外的Jason McDonald小哥就为我们整理出了一个超精简版设计模式文件（文末有下载链接 ，大家可以去下载原PDF文件）

所谓精简版，既没有详细地论证和介绍每一个模式，而是让在你有一定理论基础的情况下，通过这个文件快速回顾或回忆起来。如果你对每一种设计模式还不清楚，建议还是先认认真真学习一遍（比如看四人帮写的相关书籍），不然看了也不深刻。![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/002-8a0b2bc1.png)![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/003-0036bf1d.png)

### 设计模式分类

    这23种设计模式，可以分为三类，如下图所示

-   蓝色的C就是创建型模式

-   绿色的B就是行为型模式

-   橙色的S就是结构型模式

![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/004-fdcfe998.png)

### 责任链模式

![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/005-645fa31f.png)

### 命令模式

![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/006-a3db9d0c.png)

### 解释器模式

![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/007-a6dd68e8.png)

### 迭代器模式

![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/008-24511dc2.png)

### 中介者模式

![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/009-a62872f9.png)

### 备忘录模式

![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/010-705aabee.png)

### 观察者模式

![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/011-ecb68789.png)

### 状态模式

![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/012-f7865201.png)

### 策略模式

![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/013-ec5c59c6.png)

### 模版模式

![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/014-f16adead.png)

### 访问者模式

![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/015-3c02557a.jpg)

### 适配器模式

![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/016-e4230923.png)

### 桥接模式

![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/017-b006237e.png)

### 组合模式

![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/018-c0d0ae99.png)

### 装饰器模式

![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/019-94fd6c12.png)

### 门面模式

![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/020-bcc9155e.png)

### 享元模式

![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/021-f40c5e77.png)

### 代理模式

![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/022-7683b2d9.png)

### 抽象工厂模式

![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/023-75327bf4.png)

### 构造器模式

![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/024-ba2cc86e.png)

### 工厂方法模式

![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/025-62cfcc77.png)

### 原型模式

![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/026-16f1022c.png)

### 单例模式

![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/027-b88d1fe1.png)

完整PDF文件可以通过这个链接下载：

-   http://www.mcdonaldland.info/files/designpatterns/designpatternscard.pdf

![Image](https://pub-f29bf2b53160470c9a85250116509a24.r2.dev/post/2020-03-14-she-ji-mo-shi-mei-shi-jian-xue-yi-tu-dai-ni-gao-ding-23-zhon/028-c0624d98.jpg)

关注公众号 获取更多精彩内容

