本篇概述#
本篇從套件與元件設計原則出發,將前一篇實作的薪資系統進行封裝與組織。先介紹元件內聚性與耦合性的六大原則,再引入更多設計模式,最後完成薪資系統的資料庫層與使用者介面。
章節導覽#
套件設計原則#
- Chapter 28 - Principles of Package and Component Design:六大原則——REP、CCP、CRP(內聚性)與 ADP、SDP、SAP(耦合性)
- Chapter 30 - Payroll Case Study: Package Analysis:將薪資系統依據原則進行套件分析與重組
設計模式#
- Chapter 29 - Factory:工廠模式解決依賴問題與可替換性
- Chapter 31 - Composite:組合模式處理樹狀結構
- Chapter 32 - Observer:觀察者模式實現事件通知
- Chapter 33 - Abstract Server, Adapter, and Bridge:三種解耦模式的比較與應用
- Chapter 34 - Proxy and Gateway:代理模式與閘道模式管理第三方介面
- Chapter 35 - Visitor:訪問者模式、非循環訪問者、裝飾者與擴展物件
- Chapter 36 - State:狀態模式的三種實作方式
薪資系統完成#
- Chapter 37 - Payroll Case Study: The Database:資料庫層的建構與設計瑕疵修正
- Chapter 38 - Payroll User Interface: Model View Presenter:以 MVP 模式建構薪資系統的使用者介面
重點: 元件設計原則(Package Principles)是 SOLID 原則在更大粒度上的延伸——SOLID 處理類別層級的設計,而元件原則處理部署與發布層級的架構決策。