Value vs Entity objects (Domain Driven Design)

后端 未结 8 1076
眼角桃花
眼角桃花 2020-11-27 10:10

I have just started reading DDD. I am unable to completely grasp the concept of Entity vs Value objects.. Can someone please explain the problems (maintainability, performan

8条回答
  •  盖世英雄少女心
    2020-11-27 10:34

    3 distinction between Entities and Value Objects

    • Identifier vs structural equality: Entities have identifier,entities are the same if they have the same identifier. Value Objects on beyond the hand have structural equality, we consider two value objects equal when all the fields are the same. Value objects cannot have identifier.

    • Mutability vs immutability: Value Objects are immutable data structures whereas entities change during their life time.

    • Lifespan: Value Objects Should belong to Entities

提交回复
热议问题