使用設計模式的好處
- 行業標準
- 節省時間
- 代碼強壯,易讀,可複用
設計模式分爲三類
- 創造設計模式
解決方向:解決創建實例問題
原文:The basic form of object creation could result in design problems or add unwanted complexity to the design (基本的創建對象將導致設計問題,或者給設計增加複雜度) - 結構設計模式
解決方向:提供不同的方式創建類的結構
原文:Structural patterns provide different ways to create a class structure, for
example using inheritance and composition to create a large object from
small objects - 行爲設計模式
創建型設計模式
- Singleton Pattern(單例模式)
- Factory Pattern(簡單工廠模式)
- Abstract Factory Pattern(抽象工廠模式)
- Builder Pattern(構建者模式)
- Prototype Pattern(多例模式)
結構設計模式
Adapter Design Pattern(適配器模式)
Composite Pattern(組合設計模式)