Announcement Announcement Module
Collapse
No announcement yet.
Referencing Aggregate Roots in DDD Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Referencing Aggregate Roots in DDD

    I have a question of how i can reference Aggregate Roots from other objects when using a domain driven design. Here is my problem

    I do not want to directly reference other Aggregate Roots from my Objects (Aggregates) as this would mean (1) I would eventually load a whole network of objects when loading one Aggregate Root (2) I would create dependencies between the Repositories

    I thought of using Proxies instead - however this does not seem to be a good idea as well as when using a proxy ideally i would be able to resolve the "real" Aggregate Root transparently - but this will require the object to use the service layer (where all the repositories are used and the transactions are maintained) - so I'll create a sependency on the service layer in the Business Objects which I don't really want as well.

    So to make this question short - how are you referencing Aggregate roots from your objects without creating a whole network of objects and still having a clean separation of the Service Layer and the Business Objects?

    Thanks in advance for your comments/suggestions/ideas
    Walter
    Last edited by wdorninger; Aug 7th, 2010, 03:34 PM.

  • #2
    Hi Walter,

    I admire your attempt to keep the architecture as "pure" as possible but I think you are at a point where the practicality of it may entail some initial dirty stuff. You can just create the proxy with a service call inside of it to at least encapsulate the service interaction to within the proxy code, that seems ok. Then later, you can figure out how to abstract away that type of service interface to make it cleaner. But it is ok to start and just see what transpires in your code.

    I think having service calls in this case is ok... You don't want to bring in the whole entity plus children that's simply out of the question.

    The proxy is just a reference to the actual object... it seems though you should just use the domain object that the aggregate root represents to do the services which use that object, not interacting through a proxy at all just using it normally. So I don't know what the structure of your domain services really looks like in that case... Seems like you have it set up more as an "Entity Layer" with repositories, in which case I think maybe your entities are too anemic and not aware of what their own power is in domain interactions. If you disagree with that that's ok just something to consider when looking at it as a whole.

    Regards,
    Jeremy

    Comment

    Working...
    X