I am trying to simulate a very simple domain that has a conceptual (one) PARENT โ (many) BABY. The problem is that the number of children in a relationship can be in the millions.
I am trying to build a shared array that will allow me to โputโ (update or insert, if not exist) one child at a time. However, updated values โโmust be pre-checked by the parent.
What patterns can I use for this? I have currently reviewed the following:
PARENT as an aggregate root
- + The check is simple, since access to the daughters is through the parent
- - Necessary, as it may be necessary to extract millions of children in order to update only one
- +/- Can I do lazy loading? I read an article highlighting that this is an anti-DDD pattern due to consistency.
CHILD as a cumulative root
- + Perform as soon as receiving data for updating
- -Validation, because it is nontrivial, either the parent must be the root entity, or the root must be externally provided to the parent for verification. Both options cause problems:
- Since the update is a โtaggedโ style, the first parameter makes it difficult to create a child (if I implement the creation of the store in the find (id) method, then I donโt have the necessary information to build the child and if I put it into the service by calling the repository, then I have no way to access parent information, as this is not a cumulative root).
- , .. , .