[TYPO3-mvc] Blog Example and Value Object question

Martin Kutschker masi-no at spam-typo3.org
Tue Dec 29 12:48:22 CET 2009


Franz Koch schrieb:
> Hi,
> 
>> It's interesting that a concept leads to strict rules. I understand
>> now that a value object has no
>> intrinsic identity. Fine. But why on earth can't I ask for a list of
>> all existing value objects of a
>> certain kind? Because a book says so? ;)
> 
> I think it's the terms used in DDD/objectPersistance that are misleading
> at the beginning, because they get interpreted in the wrong way by still
> having "traditional" concepts in mind.
> An identity of a object stands for the uniqueness of object, which
> doesn't mean that a object without a unique identity/personality doesn't
> have any identifier on database level. That's a thing I just learned.

That's what I also understood. The other thing is that putting all the tidbits together I find in
newsgroups is tiring. I have ordered now the DDD book.

> Maybe a example might help - and I hope I got this one right:
> 
> Assume we have a valueObject "name" and a "person" object (which are not
> related to each other in this example), and both of them have the
> name/value "John Doe". Also assume the according repositories could
> contain several objects with this name/value.
> 
> Now, if you ask the nameRepository to give you a valueObject back that
> has the value "John Doe", you actually don't care which one of the John
> Does you get back, because you only care for the correct value that any
> of those has. So they are interchangeable. But although they are
> interchangeable and have no necessary personality/"identity", you still
> can ask the repository to give you a list of all names.

So to get back to the blog example, the repository may give a list of all tags. But, there is no tag
repository in the blog example.

> Hope that helps somebody - and I hope I got it right ;)

The key point is probably that the application will decide if a certain object is an entity or a
value object.

Masi


More information about the TYPO3-project-typo3v4mvc mailing list