領域邏輯模式(
Domain Logic Patterns)
1、Transaction Script(事務指令碼)
Organizes business logic by procedures where each procedure handles
a single request from the presentation.
For a full description see P of EAA page 110
Most business applications can be thought of as a series of
transactions. A transaction may view some information as organized in
a particular way, another will make changes to it. Each interaction
between a client system and a server system contains a certain amount
of logic. In some cases this can be as simple as displaying
information in the database. In others it may involve many steps of
validations and calculations.
A Transaction Script organizes all this logic primarily as a single
procedure, making calls directly to the database or through a thin
database wrapper. Each transaction will have its own Transaction
Script, although common subtasks can be broken into subprocedures.
通過過程來組織商務邏輯,其中每一個過程用來處理來自展示層的一個單獨的請求!
本模式詳細描述參考 PEAA 110頁
多數的商務應用程式可以看作是一系列的事務,一些事務可能是查看一些以特定方式組織的資訊,另一些事務可能是用來改變這些資訊。一個客戶系統和一個服務系統之間的每次互動包含了一定數量的商務邏輯.在某些情況下,這些互動可能是像顯示資料庫中的資訊一樣簡單。其他情況互動可能包括了多個步驟的驗證和計算。事務指令碼主要通過單獨的過程組織了所有的商務邏輯。包括直接和資料庫互動,或者通過簡單的資料庫封裝器。每個事務將擁有自己的事務指令碼,儘管公用的子任務可以被分解成子過程!