I know that outside of aggregates I can't change anything inside an aggregate without passing by his root. That said I would like to know if an aggregate root can hold references of members (objects insides) of another aggregate root? (following DDD rules)

Example :

a Calendar contain a list of phases which contain a list of sequences which contain a list of assignations

Calendar is root because phases and sequences and assignations only work in context of a calendar.

You also have Students and Groups of student (called groups)

It is possible (following DDD rules) to make Groups holding references of assignations or it need to pass by the root for accessing groups from assignations ?


  • 3
    This feels to me like it belongs on SO. Feb 11, 2011 at 1:39
  • 2
    Well i dont think. This is a programming question. Stackoverflow is more like a technical questions i think ?
    – Rushino
    Feb 11, 2011 at 1:59
  • Is it possible for a Group to change Assignation, making Calendar invalid? I would say that a Group should only hold the ID of the Assignation, and not the reference to the object Assignation. This way only Calendar is responsible for changing Assignations, and connecting Groups and Assignations.
    – omittones
    May 23, 2015 at 17:56

4 Answers 4


If I understand your question correctly, you are asking about the basics of UML class diagrams?

Would like to know if its possible to hold multiple references of an aggregate root (groups) inside another aggregate root (calendar) member ?

Classes can be associated with any other classes, in any way they want. That's the whole purpose of designing a system.

Also how a list of references are represented in UML ? it is a simple relation ?

A list of references can either be aggregation (has a) or composition (owns a).

But assignations must hold multiple references to groups of students. (Must work two sides)

This isn't really clear, you are talking about a bidirectional relation between groups and students? In any case, perhaps this article on many to many relations can provide you with some insight.

If there was no such thing as “student”, would there be meaning to “student group” ? Probably not. If there was no such thing as “student group”, would there be meaning to “student” ? Probably.


It is possible (fellowing DDD rules) to make Groups holding references of assignations or it need to pass by the root for accessing groups from assignations ?

I never modelled a system with DDD in mind, but by reading the previously mentioned article. I would say, try to prevent it when not necessary, if there are no performance issues, access the groups through assignations. That is, if that's the correctly chosen aggregate root.

Apply the "student, student group" example to all your elements to choose the correct aggregate roots.

  • But in a DDD i must avoid bidirectional stuff. Is there a way to transfoem this to become unidirectional?
    – Rushino
    Feb 11, 2011 at 0:04
  • @Rushino: Could you update your question to clarify the bidirectional relation more clearly? Feb 11, 2011 at 0:07
  • I edited my question. Should be more clear now. I am sorry for unclear parts. Actually all i need to know if its an aggregate root can hold references to another aggregate roots objects part of the aggregate.
    – Rushino
    Feb 11, 2011 at 1:10
  • @Rushino: Updated the reply to answer your better formulated question. Feb 11, 2011 at 12:27

What is the significance of an assignation? If there is a natural relationship between Groups and assignations then the group can hold a direct reference to it's Assignations. But as you noted, changes to assignations can only be made through the Calendar if that is the root.

I think we need more detail about the relationship of Calendars, Phases, Assignations, and Groups. What is an Assignation, how is it used?

  • Assignations are like taking a group and a period (start date and end date) and bind them together in a sequence which is owned by a phase which is owned by a calendar.
    – Rushino
    Feb 11, 2011 at 1:52

I'll make some wild assumptions about your data structure and say


otherwise there's no way of establishing and maintaining the reference. The different aggregate roots would still have their own repository.

hey, if I'm wrong, someone (Pierre, probably) will correct me with a link and then we'll both learn something.


My understanding:

An outside entity can ask a root for a copy of an entity inside that aggregate for its own use. However, the root should not return a reference to the actual entity. Only the root is allowed to change properties in the aggregate so that it can maintain a valid state.

It can be difficult to enforce these rules in code (it is easy to provide a reference to a collection and add/remove directly from it instead of asking the root AddItem/RemoveItem).

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.