[TYPO3-mvc] Blog Example and Value Object question

Franz Koch typo3.RemoveForMessage at elements-net.de
Tue Dec 29 11:29:08 CET 2009


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.

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.

In opposit, if you ask the personRepository for a person named "John 
Doe" you most likely are looking for a specific person, maybe your 
friend. So you actually care which one of the John Does you get back - 
you're searching for a person with a certain personality, a specific 
identity. There is only one Martin Kutschker, only one Nathan Lenz and 
only one Franz Koch that are related to this posting. Although in the 
whole world(Repository) there might be more guys having the same names 
as we have, we're not interchangeable with them, because everybody could 
see that it's not us.



Of course there might be situations where you might not care if you get 
a specific person but just need any person, and there might be 
situations where you're looking for a specific name written in a special 
font with rainbow colors. In those cases you would have to change the 
objectTypes accordingly. But this depends on the domain you're using 
these objects in. So there is no strict rule that a person has to be a 
entity.

Hope that helps somebody - and I hope I got it right ;)
-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list