views:

272

answers:

3

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

EDIT:

Imagine, that you have to build SO website. How would you consider 'tag'?

+2  A: 

value type

awhite
+6  A: 

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

George Mauer
Thank you. I couldn't have said it better myself.
awhite
Isn't tag label his identity itself?
Bartek Szabat
Its not that value types don't have an identity its that all instances of a particular sort have the same identity
George Mauer
You have to render user's tag list on user page. Doesn't it make 'tag' an entity? I'm noob to DDD, can you explain more ? :)
Bartek Szabat
George Mauer
+1  A: 

Just some additional considerations: Tags can be normalized, "DDD" should be equal to "ddd" and "DdD", and in most tag systems, spaces get replaced with "_" underscores. Also I guess the creator will be tracked for the badge system.

kitsune
Those are certainly worthwhile considerations. Let me point out that a value type (tag) can reference an entity (user)
George Mauer