I am confused about aggregate objects and that only aggregate objects have repositories because I don’t know how to properly code it.
Assume that you have a User, Question and QuestionLog entity. I don’t understand how to set the boundaries for how much you should put in an aggregate object. You could say that no questions would live in my system without a user, and a questionlog would not exist if it had no questions to be attached to. So would user be an aggregate root?
How would you add a questionlog then for instance?
For me it seems like you end up with a lot of nesting etc. User.addQuestionLog? I don’t understand where the boundaries go for when it should be an aggregate and seen as a unit? For me it would be more natural that User is one aggregate and Question is another. However I don’t understand how to actually know this.
And a question can have categories too, would the category also be a part of question or not? Why/why not? How to spot them?
Don’t think of the objects, DDD is all about real life.
The real questions are:
Hence:
So we end up with three root aggregates.
The category is value object