[TYPO3-mvc] Blog Example and Value Object question

Martin Kutschker masi-no at spam-typo3.org
Mon Dec 28 09:21:23 CET 2009


Michael Knoll schrieb:
> Hi Masi,
> 
> without looking at the blog-code, I would say that "Tag" cannot be a
> value object. Like written earlier in your last discussion, "sex" could
> be a value object, as it has only two states "male", "female" that don't
> change over time, need not be persisted etc.
> 
> A tag has a "tag-word" as a state, so there are as many possible values
> as there are words. So in my opinion it's no value object!

I didn't want to discuss whether a tag (in the blob example) is an entity or a value object, but if
a value object should have any setters at all. If it is immutable a constructor should be enough.

But to get back to your argument. I disagree, a tag is a value object because its value cannot
change without changing its identity. So the choice is - as far as my limited understanding of DDD
allows me to judge - correct.

Masi


More information about the TYPO3-project-typo3v4mvc mailing list