Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok I've changed my mind. I have been trying to deal with VOs a bunch lately and after watching this <a href="http://www.infoq.com/presentations/Value-Objects-Dan-Bergh-Johnsson">http://www.infoq.com/presentations/Value-Objects-Dan-Bergh-Johnsson</a> it clarified a couple of things for me.</p> <p>Commands and Event are messages (and not objects, objects are data + behavior), in some respects much like DTOs, they communicate data about an event and they themselves encapsulate no behavior.</p> <p>Value Objects are not like DTOs at all. They are a domain representation and they are, generally speaking, rich on behavior like all other domain representations.</p> <p>Commands and Events communicate information into and out of the domain respectively, but they themselves do not encapsulate any behavior. From that perspective it seems wrong and a possibly a violation context boundaries to pass VOs inside of them. </p> <p>To paraphrase Oren (though he was referring to nHibernate and WCF) "Don't send your domain across the wire". <a href="http://ayende.com/Blog/archive/2009/05/14/the-stripper-pattern.aspx">http://ayende.com/Blog/archive/2009/05/14/the-stripper-pattern.aspx</a></p> <p>If you want to communicate a value object, then I suggest passing the necessary attributes needed to re-construct the VO within them instead.</p> <p>Original Text (for posterity):</p> <p>If you are asking if Value Objects can be passed by the domain model to events or passed in by commands, I don't really see a huge problem with the former, though the latter may violate some of the rules of the aggregate root being the "owner" of values.</p> <p>That said a value object represents concepts like for example a color. You don't <em>have</em> green, you <em>are</em> green or not. There seems to be nothing intrinsically wrong with a command telling you that you are green by passing this.</p> <p>Reading the chapter from DDD on the Aggregate Root pattern explains Entities and Value Objects quite well and is worth reading over a few times.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload