Skip to content

Commit

Permalink
策略模式
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexchent committed Jul 4, 2021
1 parent 74a1ec8 commit 5fcbed5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions DesignPatterns/Strategy/strategy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# 策略模式策略模式用一个成语就可以概括 —— 殊途同归。当我们做同一件事有多种方法时,就可以将每种方法封装起来,在不同的场景选择不同的策略,调用不同的方法。> 策略模式(Strategy Pattern):定义了一系列算法,并将每一个算法封装起来,而且使它们还可以相互替换。策略模式让算法独立于使用它的客户而独立变化。比如有redis和memcached两种缓存策略,我们需要根据业务情况灵活的选择不同的策略
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@
3. 解释器模式 基本用不到
4. 中介者模式
5. 观察者模式!!
6. 状态模式 用多个状态类代替if-else
7. 策略模式

## [Swoole客户端&服务端](/Swoole)
1. 启动服务端
Expand Down

0 comments on commit 5fcbed5

Please sign in to comment.