I've been doing a lot of research on DDD and have been stumbling a bit on the concept of Aggregates vs Aggregate Roots.
Say I'm trying to model a space game that exists in a strict hierarchy, with a Sector
Entity that wraps around everything contained within it. It can have a collection of PlanetarySystem
, each of those can have a collection of Star
, the stars can have a collection of Planet
which themselves can have a collection of Moon
I want all of these objects to either be associated with that Sector
, situated nicely in the hierarchy, but it can also be associated with no sector. Each item can have a 0 or 1 relationship with the object in the hierarchy above it... floating in the ether if need be. I want to be able to delete a Planet
without deleting all the Moon
entities it has, but it can be done optionally.
Am I wrong to think that these should each be their own Aggregate Root in this scenario, with references to the Aggregate Root instances that they contain? Or should the Sector
be the actual Aggregate Root, orchestrating everything as the object at the top of the hierarchy?