[TYPO3-mvc] Query value objects. How can I handle it?

Jochen Rau jochen.rau at typoplanet.de
Fri Apr 30 14:10:47 CEST 2010


Hi Franz.

On 30.04.10 12:59, Franz Koch wrote:
> Hey,
>
>> I did not encounter a major drawback having a Repository for
>> ValueObjects -- yet ;-)
>
> which makes them some sort of entities ;)

The difference between an Entity and a ValueObject is, that the 
ValueObject has no concept of "identity" (that's taken from Eric Evans) 
or -- IMHO -- its identity is determined by the complete set of property 
values.

BTW The fact the object has an (internal) property "uid" does not 
necessarily give him an "identity" in the sense of DDD.

We don't have to care about if it is ValueObject "Blue" or ValueObject 
"Blue". It's simply "Blue" ;-). (In contrast: We have to care if the 
Entity "Jochen" is the Entity "Jochen" we have in mind. Because there 
might be more than one "Jochen" in our Universe (and Parallel Universes, 
of course).

The Advantage of ValueObjects is, that we don't have to track their 
Identity, thus, we can clone them or instanciate them whenever or 
wherever we like. May it be in a Repository. The tricky thing now is, 
that ValueObjects have to be immutable. You can paint your "Blue" house 
"Red" but you cant change "Blue" to "Red". So, having public setters in 
ValueObjects makes no sense (or you have to know what you do ;-)).

Regards
Jochen


More information about the TYPO3-project-typo3v4mvc mailing list