使用設計模式的三個最重要的要素是:
- 知道在何處尋找設計模式
- 知道如何將設計模式應用於軟體工作
- 如何識別出現在別人的軟體中的設計模式
稍加練習,您會發現尋找一個可能適用於特定問題領域的設計模式是相當容易的。實際上,通常會發現適用於您問題領域的模式太多了。一旦把所有可行的模式彙集成一份清單,那麼,確定哪個模式最適合應用於您的軟體設計會是一個難題。使用模式時,經驗是關鍵。有了經驗,您將知道去哪尋找適合於某個特定情形的模式,並且知道如何將模式融入軟體解決方案。當您作為一名軟體開發人員在職業和經驗方面不斷進步時,也就學會憑直覺識別出其他人的設計中的模式。
設計模式網站
- Brian Foote 的網站(http://www.laputan.org/foote/papers.html)是學習設計模式的一座知識寶庫
- Martijn van Welie 模式網站(http://www.welie.com)包含許多適用於使用者介面和 Web 可用性設計的模式。
- 可以在 IBM 的 Patterns for e-business 網站(http://www-106.ibm.com/developerworks/patterns/index.html)上找到 Simple Policy 和 Property Container 模式。
- Front Controller 模式是可以在 Sun Microsystems 的 Java BluePrints 網站(http://java.sun.com/blueprints/index.html)上找到的幾種有用的 J2EE 設計模式之一。
- Object Management Group(http://www.omg.org)負責 Event Channel 設計模式。
- Patterns for e-business 網站已經更新,包含新的 Access Integration 設計(http://www-106.ibm.com/developerworks/patterns/access/index.html),它使使用者能通過單點登入過程訪問多個後端系統(通過瀏覽器或者通過目前的普及裝置客戶機)。Access Integration 還允許您根據使用者角色、身份和喜好個人化內容。學習更多有關這些功能強大的設計模式知識。
- 另外還有:http://www.theserverside.com/patterns/index.tss。
- http://www.dofactory.com/Patterns/Patterns.aspx。
- http://www.javajia.com/pattern.php
推薦書籍
- 第一本要看的書:Design Patterns: Elements of Reusable Object-Oriented Software(Gamma,Helm,Johnson,Vlissides,Addison-Wesley,1995,http://cseng.aw.com/book/0,3828,0201633612,00.html)。
- GOF 的成員之一 John Vlissides 還寫了 Pattern Hatching (Design Patterns Applied)一書(Addison-Wesley,1998,http://www.amazon.com/exec/obidos/ASIN/0201432935/qid=1015942491/sr=1-9/ref=sr_1_9/104-1891410-7851159)。
- Pattern Almanac 2000(Rising,Addison-Wesley,2000, http://www.aw.com/catalog/academic/product/1,4096,0201615673,00.html#summary)是學習設計模式的重要參考資料。
- Pattern-Oriented Software Architecture, Volume 2: Patterns for Concurrent and Networked Objects(Schmidt,Stal,Rohnert,Buschmann,Wiley,2000, http://www.wiley.com/Corporate/Website/Objects/Products/0,9049,104671,00.html)是那些使用模式協助您學習特殊領域軟體開發的書之一。該書也是對所有模式庫的很好補充。
- 同一系列的(該系列的第一部分)書是 Pattern-Oriented Software Architecture, Volume 1: A System of Patterns(Buschmann,Meunier,Rohnert,Sommerlad,Stal,Wiley,1998, http://www.wiley.com/Corporate/Website/Objects/Products/0,,104675,00.html)。
- 即將出版的 Framework Process Patterns: Lessons Learned Developing Application Frameworks(Carey,Carlson, Addison-Wesley,2002,http://www.amazon.com/exec/obidos/ASIN/0201731320/qid=1015908003/sr=1-2/ref=sr_1_2/104-1891410-7851159)是為那些學習設計模式進階知識的人而準備的。它討論了舊的設計模式是如何派生的,以及專門應用於構建架構的新模式。其中的一個模式“Missed it by That Much”給出了使用現有模式和發現新模式的清晰界線。
- 也是由 James Carey 和 Brent Carlson 合著的 SanFrancisco Design Patterns: Blueprints for Business Software(Addison-Wesley,2000, http://cseng.aw.com/book/0,3828,0201616440,00.html)
- Patterns for e-business: A Strategy for Reuse(Adams, Galambos,Koushik,Vasudeva,IBM Press,2001,http://www.mcpressonline.com/ibmpress/5206.htm)可以以書的形式獲得。
- Designing Enterprise Applications with the Java 2 Platform (Enterprise Edition) 同樣出自 Java BluePrints 網站,(Kassem,Addison-Wesley,2000, http://www.digitalguru.com/product_detail.asp?catalog%5Fname=Books&product%5Fid=0201702770)。
其它參考資料
- 可以在 IBM developerWorks Java 技術專區(http://www-106.ibm.com/developerworks/java/)找到上百篇 Java 編程各個方面的文章。
- 請參閱 developerWorks Java 技術教程頁面(http://www-105.ibm.com/developerworks/education.nsf/dw/java-onlinecourse-bytitle?OpenDocument&Count=500/),從 developerWorks 擷取更多免費 Java 教程的完整清單。
- 請參閱 Guide to developer kits from IBM(http://www-106.ibm.com/developerworks/library/i-tools.html)擷取最新的 IBM 開發人員工具集的清單。