SlideShare a Scribd company logo
1 of 19
DDD Reading Club Sharing
Ch. 6 Value Object
Brinkley
Introduction
❏ Value Characteristics
❏ Integrated with Minimalism
❏ Standard Types Expressed as Values
❏ Testing Value Objects
❏ Persisting Value Objects
Value Characteristics
❏ Measures, Quantifies, or Describes
❏ Immutable
❏ Conceptual Whole
❏ Replaceability
❏ Value Equality
❏ Side-Effect-Free Behavior
Example
❏ 玩家的錢包餘額有1000塊人民幣,表示了兩個屬性,1000塊與人民幣
,單獨一個屬性都無法表示錢包餘額
Example
❏ 在建構函式中傳入Value Object所需的參數,並初始化Value Object的
屬性
Example
❏ 玩家的錢包餘額有1000塊人民幣,下注後要扣款100塊,基於Value
Object is an immutable的特性,要如何改變Value Object內的值?
Example
❏ 如何判斷兩個Value Object是相等的
Integrated with Minimalism
❏ Where possible use Value Objects to model concepts in the
downstream Context when objects from the upstream Context flow in
Integrated with Minimalism
Standard Types Expressed as Values
❏ Enum
❏ State Pattern
Testing Value Objects
❏ Your model tests should have meaning to your domain experts
❏ The state of the Value Object was guaranteed immutable for every
Persisting Value Objects
❏ ORM and Single Value Objects
❏ ORM and Many Values Serialized into a Single Column
❏ ORM and Many Values Backed by a Database Entity
❏ ORM and Many Values Backed by a Join Table
❏ ORM and Enum-as-State Objects
ORM and Single Value Objects
❏ Store each of the attributes of the Value in separate columns of the
row where its parent Entity is stored
❏ Value attributes are denormalized into their parent Entity’s table row,
there is no need for the database to use joins to retrieve even a
deeply nested Value instance
ORM and Many Values Serialized into a Single Column
❏ Mapping a collection of many Value Objects into a relational
database using an ORM
❏ To serialize the entire collection of objects into a textual
representation and persist the representation into a single column
ORM and Many Values Backed by a Database Entity
❏ To treat the Value type as an entity in the data model
ORM and Many Values Backed by a Database Entity
ORM and Many Values Backed by a Join Table
❏ To persist the collection Value elements to a dedicated table with the
parent Entity domain object’s database identity as a foreign key
WorkShop
1. 系統有四個角色 Manager/Operator/Partner/Engineer
2. 會員登入 輸入Account/Password來驗證身份
3. 玩家資料 可以輸入MemberCode或PartnerCode來查詢玩家資料
- 只有Partner不需要輸入PartnerCode 但是只能查到自己玩家的資料
- 只有Manager/Operator/Partner 可以調整玩家錢包的餘額
- 畫面上會呈現MemberCode/PartnerCode/錢包餘額
4. 玩家下注資料 可以輸入MemberCode或PartnerCode或日期區間來查詢玩家下注資料
- 只有Partner不需要輸入PartnerCode 但是只能查到自己玩家的資料
- 畫面上會呈現MemberCode/PartnerCode/下注金額/下注時間/結果(輸或贏或是未有
結果)
Reference
❏ Implementing domain driven design

More Related Content

More from Eason Kuo

Implementing Domain-Driven Design (Study Group) Chapter 3 - Context Maps
Implementing Domain-Driven Design (Study Group) Chapter 3 - Context Maps Implementing Domain-Driven Design (Study Group) Chapter 3 - Context Maps
Implementing Domain-Driven Design (Study Group) Chapter 3 - Context Maps
Eason Kuo
 

More from Eason Kuo (17)

[2020 DDD TW Conference Workshop] Go Ahead DDD Tactical Modeling
[2020 DDD TW Conference Workshop] Go Ahead DDD Tactical Modeling[2020 DDD TW Conference Workshop] Go Ahead DDD Tactical Modeling
[2020 DDD TW Conference Workshop] Go Ahead DDD Tactical Modeling
 
DDD 拼圖中的另一半 – 以戰術實踐代碼
DDD 拼圖中的另一半 – 以戰術實踐代碼DDD 拼圖中的另一半 – 以戰術實踐代碼
DDD 拼圖中的另一半 – 以戰術實踐代碼
 
Working effectively with legacy code study group - ch12,13,14
Working effectively with legacy code study group -  ch12,13,14Working effectively with legacy code study group -  ch12,13,14
Working effectively with legacy code study group - ch12,13,14
 
IDDD Ch.09 Module
IDDD Ch.09 ModuleIDDD Ch.09 Module
IDDD Ch.09 Module
 
IDDD Ch.08 Domain Event
IDDD Ch.08 Domain EventIDDD Ch.08 Domain Event
IDDD Ch.08 Domain Event
 
2016 - What should we do in Startup
2016 - What should we do in Startup2016 - What should we do in Startup
2016 - What should we do in Startup
 
20140904 - ADRMS 介紹 - 企業文件版本權管理
20140904 - ADRMS 介紹 - 企業文件版本權管理20140904 - ADRMS 介紹 - 企業文件版本權管理
20140904 - ADRMS 介紹 - 企業文件版本權管理
 
第八屆微軟學生大使 - 第三階段面試簡報主題 - Kinect開發概觀
第八屆微軟學生大使 - 第三階段面試簡報主題 - Kinect開發概觀第八屆微軟學生大使 - 第三階段面試簡報主題 - Kinect開發概觀
第八屆微軟學生大使 - 第三階段面試簡報主題 - Kinect開發概觀
 
2012/05/07 - Kinect Senor Development Introduction
2012/05/07 - Kinect Senor Development Introduction2012/05/07 - Kinect Senor Development Introduction
2012/05/07 - Kinect Senor Development Introduction
 
Windows 8 介紹與 Windows 8 App 開發概觀
Windows 8 介紹與 Windows 8 App 開發概觀Windows 8 介紹與 Windows 8 App 開發概觀
Windows 8 介紹與 Windows 8 App 開發概觀
 
分享擔任第八屆微軟學生大使的過程與經驗
分享擔任第八屆微軟學生大使的過程與經驗分享擔任第八屆微軟學生大使的過程與經驗
分享擔任第八屆微軟學生大使的過程與經驗
 
招募第九屆微軟學生大使 - 第三階段的專案競賽規則
招募第九屆微軟學生大使 - 第三階段的專案競賽規則招募第九屆微軟學生大使 - 第三階段的專案競賽規則
招募第九屆微軟學生大使 - 第三階段的專案競賽規則
 
Windows Phone 7 on Visual Studio 2010
Windows Phone 7 on Visual Studio 2010Windows Phone 7 on Visual Studio 2010
Windows Phone 7 on Visual Studio 2010
 
Windows Phone Survey on Game Development
Windows Phone Survey on Game DevelopmentWindows Phone Survey on Game Development
Windows Phone Survey on Game Development
 
Implementing Domain-Driven Design (Study Group) Chapter 3 - Context Maps
Implementing Domain-Driven Design (Study Group) Chapter 3 - Context Maps Implementing Domain-Driven Design (Study Group) Chapter 3 - Context Maps
Implementing Domain-Driven Design (Study Group) Chapter 3 - Context Maps
 
視界 - 微客志工師大Wake分享會
視界 -  微客志工師大Wake分享會視界 -  微客志工師大Wake分享會
視界 - 微客志工師大Wake分享會
 
微客志工 - 533T 菲去cebu 熱血服霧
微客志工 - 533T 菲去cebu 熱血服霧微客志工 - 533T 菲去cebu 熱血服霧
微客志工 - 533T 菲去cebu 熱血服霧
 

Recently uploaded

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Recently uploaded (20)

Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

DDD Reading Club Sharing Ch. 6 Value Object