What is “Entity” in DDD?k-kuwahara @kuwahara_jsri @clown0082Mar 10, 2020 Active Book Dialogue @Yumemi
View Slide
const my_info = {Workplace: ‘Yumemi Inc’,Position1: ‘Servant Leader of FET’,Position2: ‘CEO(secondary)’,Community: ‘Riot.js, Ionic, DIST’,PokemonGO: ‘TL40’}About me
npm/~kkeeth
github.com/riot
definition of “Entity”
embodyDomainModelDomainObjectdefinitin of “Entity”
embodyDomainModeldefinitin of “Entity”DomainObjectBut, there are 2 objects. So,“Value Object”, “Entity”
What is the difference between“Value Object” and “Entity”?
the differenceValue Object Entitydiff attributes/variables identityproperty immutability valiabilitychange exchange/substitution behavior
Value Object
Value ObjectName: JohnAge: 32Gender: MaleName: EmilyAge: 27Gender: Female
Value ObjectName: JohnAge: 32Gender: MaleName: JohnAge: 32Gender: Male
Entity
EntityName: JohnAge: 32Gender: MaleName: EmilyAge: 27Gender: Female
EntityName: JohnAge: 32Gender: MaleName: JohnAge: 32Gender: Male
How do “Entity”identify each other?
EntityID: 12345Name: JohnAge: 32Gender: MaleID: 98765Name: JohnAge: 32Gender: Male
EntityID: 12345Name: JohnAge: 32Gender: MaleID: 98765Name: JohnAge: 32Gender: Maleidentity identityID: 12345 ID: 98765
Merits of “Entity”
merits of “Entity”Code is more documentableMake changes in our domaineasier to communicate toyour code
merits of “Entity”
embodymerits of “Entity”
Let’s join DDD!!