For example, we have two domain objects: Cell and Body (as in a human cell and body).
The Body class is just a collection of cells, for example
class Body
{
IList<Cell> cells;
public void AddCell(Cell c) { ... }
public void RemoveCell(Cell c) { ... }
}
Cell has a Split method that creates its own clone, for example
Class Cell
{
public Cell Split()
{
Cell newCell = new Cell();
return Cell;
}
}
Now that DDD, when the cell is broken, should:
- A cell adds a newly created cell to the Body (which would mean that each Cell object contained a link to its containing body)?
- Or should the service level that received the Split userβs internal request request collect the returned cell and add it to the Body? (feels like a more anemic design using controllers rather than domain objects).
- Or should the body contain a SplitCell method?
Thanks in advance.