[Draft]: Organizing Domain Logic
What is a Design Pattern?
Design Pattern 通常需要具備幾個描述要件 Context, Problem, Solution。
Context
解釋目前遇到的問題,所以需要提出一個 pattern
Problem
描述遇到的問題,所以需要權衡的難點 (Forces),這個難點通常會是有互斥的狀況。
Solution
提出的方案,需要平衡難點,通常會需要提出兩個面向
靜態 Relationship
Run-time behaviour
Domian Logic Problem Context
Domain Logic 在維護上管理上,需要精準的處理 Business model 需要兼顧軟體的維護性、可理解性、效能以及可測試性。當隨著軟體迭代,維護性、可理解性、效能以及可測試性都會隨著時間越來越複雜。
Problem
要如何保持低開發成本
隨著時間產品生命週期越久,所需要開發成本越高
指的是維護性、可理解性、效能以及可測試性
開發時間: 測試時間,開發時間,理解程式碼
Solution
從[1] 文獻中,主要有三個 pattern 使用 Transaction Script, Table Moudle, Domain Model,隨著產品的生命週期,可以採用以順序為: Transaction Script -> Table Moudle -> Domain Model 。
Transaction Script
Def: Organizes business logic by procedures where each procedure han-dles a single request from the presentation
Domain Model
Def: An object model of the domain that incorporates both behavior and data
Table Moudle
def: A single instance that handles the business logic for all rows in a database table or view.
Reference
[1] Fowler, Martin. Patterns of enterprise application architecture. Addison-Wesley, 2012.
Last updated
Was this helpful?