I have a question related to relationships between aggregates in Domain Driven Design.

I have the following situation: I have an aggregate (questionnaire) which has some children (questions). The questions are entities, but because they are inside the questionnaire aggregate they can have local identities (i.e. question with id 1 in questionnaire with id 1234; I can have another question with id 1 but in another questionnaire). So to refer to a question you always have to qualify it with its parent questionnaire id.

On the other side I have another aggregate (collection campaign) which stores data (response set) for the questions in a questionnaire (the collection campaign points to the questionnaire by its id, and a response set points to a question again by its id). I can have several collection campaigns (which took place at different times perhaps) and each collection campaign stores different response sets, but for the same questionnaire (and questions).

So my question is: have I designed this well (according to DDD)? Or do I have to keep the questionnaire and questions as separate aggregates of themselves in order to refer to them from the collection campaign/response sets?

I hope this makes sense and thank you.

1 Answer 1


I think this is fine, though you should consider the campaign to member the same aggregate. Otherwise if you delete a questionnaire the campaign gets orphaned. A campaign can't live on without it's questionnaire. Also using the local question ids would be a cleaner fit if it members the same aggregate.

  • Well, actually I thought of this scenario as well. However my worry was that I would end up with too big of an aggregate, that for a simple scenario (like changing the name of the questionnaire) would have to be loaded fully in memory, questions, answers and all. Or am I wrong? I was thinking to solve the orphaning issue with an event, maybe? What do you think? As you can see I am very confused :) Feb 11, 2017 at 21:38
  • @Eduard Popescu Never consider the orphaned rule when trying to find aggregate boundaries. It's a very artificial rule most of the time: it usually doesn't matter if there's a few milliseconds delay between the time the parent is deleted and the children are.
    – plalx
    Feb 15, 2017 at 5:03
  • @plalx You mean the eventual consistency? Yes, it makes sense. So when deleting a questionnaire, the questionnaire emits an event which will eventually delete the associated collection campaigns. Is that what you mean? Feb 15, 2017 at 8:58
  • @EduardPopescu Yes, I mean eventual consistency. Otherwise your AR boundary will be so large that it will severely harm concurrency. Even with your collection campaign AR, how will you deal with cases where multiple users are simultaneously answering? Since the response sets are all part of the same AR it will create contention between all users trying to respond to the questionnaire.
    – plalx
    Feb 22, 2017 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.