SlideShare a Scribd company logo
1 of 46
Download to read offline
Transaction Patterns
Briefly
2017/01/03
Taka Wang
Why Transaction Patterns
• 所有重要且需要紀錄在系統中的事件 (Event),都可以視為交
易易 (Transaction)
• A transaction is a recording or logging of any event of
significance; hence, you could call it a significant event
remembered.
• A transaction object knows about a significant event, knows
who the players are in that event, and calculates things
pertaining to that event. (⼈人事地物)
• Peter Coad et. 1996. Object Models: Strategies, Patterns,
& Applications
Connect to Event Storming
1.Invite the right people
2.Provide unlimited modelling space
3.Explore the domain starting from Domain
Events
4.Explore the origin of Domain Events
5.Look for Aggregates
Transaction Patterns
交易易細項
參參與者: ⾞車車
啟動者: ⾞車車主 交易易: 修⾞車車 後續交易易: 付款
後續交易易細項: 付款細項
⼈人事(交易易)地物
10 sub-patterns
• actor-participant (⾏行行動者-參參與者)
• participant-transaction (參參與者-交易易)
• place-transaction (地點-交易易)
• specific item-transaciton (特定物品-交易易)
• transaction-transaction line item (交易易-交易易
細項)
• transaction-subsequent transaction (交易易-後
續交易易)
• transaction line item-subsequent transaction
line item (交易易次項-後續交易易次項)
• item-line item (物品-交易易次項)
• specific item-line item (特定物品-交易易次項)
• item-specific item (物品-特定物品)
旅館訂房服務
(Just a taste)
先找 Domain 中的 Class
• 房間:真正住進去,特定房號的房間。
• 房型:顧客在訂房時,通常是預定某個房型的房間。
先找 Domain 中的 Class
• 房間:真正住進去,特定房號的房間。
• 房型:顧客在訂房時,通常是預定某個房型的房間。
找關係(1對多)
幫關鍵交易易找關係(多對多)
⼀一次訂房可以預定多種房型,⽽而每⼀一種房型也可跟多個不同訂房事件有關
主要事件
分拆多對多關係
分拆多對多關係
Composition Relation
套⽤用 Pattern
{⼈人事(交易易)地物}
套⽤用 Pattern
{⼈人事(交易易)地物}
加入特定物品 (Specific Item)
加入特定物品 (Specific Item)
加入特定物品 (Specific Item)
微調,待修正
加入後續交易易 (subsequent Transaction)
訂房後,後續交易易是什什麼?
訂房後,後續交易易是什什麼?
細部討論
業務規則
• ⼀一次訂房可以訂多
間,但只能是同⼀一
預定⽇日期。
• 要訂多天要拆成多
筆交易易。
• ⼀一次入住事件對應
⼀一間房間
業務規則
• ⼀一次訂房可以訂多
間,但只能是同⼀一
預定⽇日期。
• 要訂多天要拆成多
筆交易易。
• ⼀一次入住事件對應
⼀一間房間
套⽤用actor-participant
演員
⾓角⾊色
套⽤用後
套⽤用後
得到模型雛形
漫畫店租借系統的領域模型
利利⽤用 Transaction Pattern 快速捕捉問題領域內的概念念物件
採購範例例
從最重要的交易易開始發想
套⽤用Pattern
向誰採購
有採購事件,必然有相關的付款事件
點餐服務
從最重要的交易易開始發想
聯聯想 OrderLine與餐點
單點菜⾊色與套餐
Note from AC
The follow-ups will center on finding the most critical "transactions" for
motion / vision / measurement applications. With a state machine
added to each transaction, everybody would certainly feel the
differences, and hopefully get amazed by such OO.
References
• 領域分析⽅方法與模式
• 學會UML類別圖的最佳⽅方法
• 利利⽤用 Transaction Pattern 快速捕捉問題領域內的概念念物件
• 學會UML/OOAD這樣開始就對了了
• 寫給SA的UML&UseCase實務⼿手冊
So Far …
CRC Card
Class Diagram
Sequence
Diagram
Analysis
Patterns
Factory
Patterns
Transaction
Pattern
Domain-Driven
Design
Refactoring
GoF 23-2
Patterns
SOLID
UML Style
Event Storming
OOAD
Creational Patterns
1.Abstract Factory
2.Builder
3.Factory Method
4.Prototype
5.Singleton
Structural Patterns
1.Adapter
2.Bridge
3.Composite
4.Decorator
5.Facade
6.Flyweight
7.Proxy
Behavioral Patterns
1.Chain of responsibility
2.Command
3.Interpreter
4.Iterator
5.Mediator
6.Memento
7.Null Object
8.Observer
9.State
10.Strategy
11.Template method
12.Visitor
Design Patterns

More Related Content

More from Jamie (Taka) Wang

More from Jamie (Taka) Wang (20)

20220113_product_day
20220113_product_day20220113_product_day
20220113_product_day
 
20200429_software
20200429_software20200429_software
20200429_software
 
20200602_insight_business
20200602_insight_business20200602_insight_business
20200602_insight_business
 
20200408_gen11_sequence_diagram
20200408_gen11_sequence_diagram20200408_gen11_sequence_diagram
20200408_gen11_sequence_diagram
 
20190827_activity_diagram
20190827_activity_diagram20190827_activity_diagram
20190827_activity_diagram
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
20161220 - microservice
20161220 - microservice20161220 - microservice
20161220 - microservice
 
20160217 - Overview of Vortex Intelligent Data Sharing Platform
20160217 - Overview of Vortex Intelligent Data Sharing Platform20160217 - Overview of Vortex Intelligent Data Sharing Platform
20160217 - Overview of Vortex Intelligent Data Sharing Platform
 
20151111 - IoT Sync Up
20151111 - IoT Sync Up20151111 - IoT Sync Up
20151111 - IoT Sync Up
 
20151207 - iot strategy
20151207 - iot strategy20151207 - iot strategy
20151207 - iot strategy
 
20141210 - Microservice Container
20141210 - Microservice Container20141210 - Microservice Container
20141210 - Microservice Container
 
20161027 - edge part2
20161027 - edge part220161027 - edge part2
20161027 - edge part2
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
Entities in DCPS (DDS)
Entities in DCPS (DDS)Entities in DCPS (DDS)
Entities in DCPS (DDS)
 
20161125 gostation
20161125 gostation20161125 gostation
20161125 gostation
 
20160420 - git intro
20160420 - git intro20160420 - git intro
20160420 - git intro
 
20161220 - domain-driven design
20161220 - domain-driven design20161220 - domain-driven design
20161220 - domain-driven design
 
20200226 - AI Overview
20200226 - AI Overview20200226 - AI Overview
20200226 - AI Overview
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 

20170104 - transaction_pattern