1

浅谈设计模式·驾驭变化之道(概览篇)

 1 year ago
source link: https://blog.sunlan.me/2023/02/12/%E6%B5%85%E8%B0%88%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F%C2%B7%E9%A9%BE%E9%A9%AD%E5%8F%98%E5%8C%96%E4%B9%8B%E9%81%93%EF%BC%88%E6%A6%82%E8%A7%88%E7%AF%87%EF%BC%89/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

浅谈设计模式·驾驭变化之道(概览篇)

2023-02-122023-02-26Design Pattern 353 1 分钟

设计模式概述

  • 设计模式(Design Pattern)是针对软件设计中普遍存在(反复出现)的各种问题所提出的解决方案;
  • 该术语由Erich Gamma、Richard Helm、Ralph Johnson和John Vlissides等人在1990年代从建筑设计领域引入到计算机科学,而该4人被称为Gang of Four(简称GoF)。

Gang of Four

Gang of Four

设计模式分类

GoF提出的经典设计模式共有23种,这些设计模式可归类为:① 创建型模式;② 结构型模式;③ 行为型模式。具体如下图所示:

设计模式作用

  • 提高代码复用性
  • 改善代码可维护性
  • 提升代码可读性
  • 保证代码可靠性
  • 促进代码编写工程化

在软件设计时,不论是宏观的架构设计,还是微观的代码设计,都围绕一个普遍的问题,即“分”与“合”、“动”与“静”的权衡。而23种经典设计模式也在不遗余力地处理该问题,并提供相应的设计指南。后续将连载以下3篇:

  • 《浅谈设计模式·驾驭变化之道(创建型模式篇)》
  • 《浅谈设计模式·驾驭变化之道(结构型模式篇)》
  • 《浅谈设计模式·驾驭变化之道(行为型模式篇)》

Software Design Pattern from Wikipedia


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK