為什麼要學習設計模式(Design Patterns) - 軟體設計大師之路 (轉)

worldblog發表於2007-12-04
為什麼要學習設計模式(Design Patterns) - 軟體設計大師之路 (轉)[@more@]microsoft 6.0">

以下比喻摘自Douglas Schmidt, n翻譯.

知識的模式(Patterns of Learning)

在人類努力解決的許多領域的成功方案都來源於各種模式(Patterns).

事實上, 教育的一個重要目標就是把知識的模式一代一代傳下去.

下面我們首先看一下學習下棋是怎樣用到模式(patterns).
學習開發一個好的類似於學習怎樣下好棋.

成為一個象棋大師
* 首先學習規則和必要條件
  例如, 棋子的名稱, 合法的棋子移動, 棋盤的幾何形狀和方向等
* 然後學習原理
  例如某一種棋子的相對價值, 中心格的戰略價值, 威脅的強度等
* 然而要成為象棋大師, 你必須要學習其他大師下過的棋局
  這些棋局就包含有模式(patterns),這些模式(patterns)必須被理解,記憶和重複的運用
* 有很多種這樣的模式(patterns)

成為一個設計大師
* 首先學習規則
  例如演算法, 資料結構和軟體語言
* 然後學習原理
  例如結構化, 模組化程式設計, 面向程式設計, 泛程式設計(general programming)等
* 但是要真正的精通軟體設計, 你必須學習其他大師級的設計
  這些設計包含的模式(patterns)必須被理解,記憶和重複的運用
* 有很多種這樣的模式(patterns)

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

Patterns of Learning

Succesul solutions to many areas of human endeavor are deeply ed 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, 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


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10752043/viewspace-987991/,如需轉載,請註明出處,否則將追究法律責任。

相關文章