DDD: SO tag. An Entity or value type?

后端 未结 3 1427
一整个雨季
一整个雨季 2020-12-19 00:56

In the context of Domain Driven Design, is a StackOverflow tag (ie. ffffd ) a value object or entity?

EDIT:

Imagine, that you have to build SO website. How wou

3条回答
  •  粉色の甜心
    2020-12-19 01:31

    To expand a little on awhite's answer a tag is a value type Why? Because it doesn't make sense to have

    var tag1 = new Tag("DDD");
    var tag2 = new Tag("DDD");
    Assert.AreNotEqual(tag1, tag2);
    

    clearly they should be equal to each other because a tag has no identity except for its label. Questions and answers on the other hand are definitely entities

提交回复
热议问题