Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>entities below the aggregate root should be immutable.</p> </blockquote> <p>No. Value objects are supposed to be immutable. <strong>Entities can change</strong> their state. </p> <p>Just need to make sure You do proper encapsulation: </p> <ul> <li>entities modifies themselves </li> <li>entities are modified through aggregate root only </li> </ul> <blockquote> <p>but Policy.addAuto() won't quite fly because one can't just pass in a new Auto (right!?)</p> </blockquote> <p>Usually it's supposed to be so. Problem is that auto creation task might become way too large. If You are lucky and, knowing that <strong>entities can be modified</strong>, are able to divide smoothly it into smaller tasks like <code>SpecifyEngine</code>, problem is resolved.</p> <hr> <p>However, "real world" does not work that way and I feel Your pain.</p> <p>I got case when user uploads 18 excel sheets long crap load of data (with additional fancy rule - it should be "imported" whatever how invalid data are (as I say - that's like saying true==false)). This upload process is considered as one atomic operation.</p> <p>What I do in this case... </p> <p>First of all - I have excel document object model, mappings (e.g. Customer.Name==1st sheet, "C24") and readers that fill DOM. Those things live in infrastructure far far away.</p> <p>Next thing - entity and value objects in my domain that looks similar to DOM dto`s, but only projection that I'm interested in, with proper data types and according validation. + I Have 1:1 association in my domain model that isolates dirty mess out (luckily enough, it kind a fits with ubiquitous language).</p> <p>Armed with that - there's still one tricky part left - mapping between excel DOM dtos to domain objects. This is where I sacrifice encapsulation - I construct entity with its value objects from outside. My thought process is kind a simple - this overexposed entity can't be persisted anyway and validness still can be forced (through constructors). It lives underneath aggregate root.</p> <p>Basically - this is the part where You can't runaway from CRUDyness.<br> Sometimes application is just editing bunch of data.</p> <p>P.s. I'm not sure that I'm doing right thing. It's likely I've missed something important on this issue. Hopefully there will be some insight from other answerers.</p>
    singulars
    1. This table or related slice is empty.
    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. This table or related slice is empty.
    1. 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