CSDN博客

img bugn

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

发表于2001/1/12 16:21:00  638人阅读

模式学习(Patterns of Learning)

以下比喻摘自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

相关博文

我的热门文章

img
取 消
img