为什么要学习设计模式(Design Patterns) - 软件设计大师之路

 以下比喻摘自Douglas Schmidt, bugn翻译.

知识的模式(Patterns of Learning)

在人类努力解决的许多领域的成功方案都来源于各种模式(Patterns).

事实上, 教育的一个重要目标就是把知识的模式一代一代传下去.

下面我们首先看一下学习下棋是怎样用到模式(patterns).
学习开发一个好的程序类似于学习怎样下好棋.

成为一个象棋大师
* 首先学习规则和必要条件
  例如, 棋子的名称, 合法的棋子移动, 棋盘的几何形状和方向等
* 然后学习原理
  例如某一种棋子的相对价值, 中心格的战略价值, 威胁的强度等
* 然而要成为象棋大师, 你必须要学习其他大师下过的棋局
  这些棋局就包含有模式(patterns),这些模式(patterns)必须被理解,记忆和重复的运用
* 有很多种这样的模式(patterns)

成为一个软件设计大师
* 首先学习规则
  例如算法, 数据结构和软件语言
* 然后学习原理
  例如结构化编程, 模块化编程, 面向对象编程, 泛编程(general programming)等
* 但是要真正的精通软件设计, 你必须学习其他大师级的设计
  这些设计包含的模式(patterns)必须被理解,记忆和重复的运用
* 有很多种这样的模式(patterns)

翻译水平有限,以下附上原文:

Patterns of Learning

Successful solutions to many areas of human endeavor are deeply rooted in patterns
In fact, an important goal of education is transmitting patterns of learning
from generation to generation
  Below, we´ll explore how patterns are used to learn chess
  Learning to develop good software is similar to learning to play good chess

Becoming a Chess Master

1) First learn rules and physical requirements
  e.g., names of pieces, legal movements, chess board geometry and orientation, etc. 2) Then learn principles
  e.g., relative value of certain pieces, strategic value of center squares, power of a threat, etc.
3) However, to become a master of chess, one must study the games of other masters
  These games contain patterns that must be understood, memorized, and applied repeatedly
4) There are hundreds of these patterns

Becoming a Software Design Master

First learn the rules
e.g., the algorithms, data structures and languages of software

Then learn the principles
e.g., structured programming, modular programming, object oriented programming, generic programming, etc.

However, to truly master software design,one must study the designs of other masters
These designs contain patterns must be understood, memorized, and applied repeatedly

There are hundreds of these patterns

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值