Geeks With Blogs
Mike Nichols - SonOfNun Technology If I were the captain on a big steamboat...

For a while, I really sought to navigate my domain via bidirectional relationships among entities. Technically, there's nothing wrong with this, but my failure to design according to the Aggregate boundaries that Eric Evans talks about in his book Domain Driven Design led to unnecessary complication in maintaining the relationships AND an anemic domain.

For example, if I consider an Employee in context of being an invariant of Enterprise and require all logic dealing with Employees to be navigated via Enterprise, I can suddenly have a rich set of rules governing what employees can be in what departments, how employees are created, etc... Implementing these kinds of things are possible wihtout understanding Aggregate bondaries, but I would typically stick that junk in Services (where they don't belong) and miss out on an expressive domain. I basically would have to do procedural checks above the domain entities to verify things happen correctly when, say, I want to Add an employee.

Having these boundaries is a great step in reducing the seeming web of entities into something I can actually manage. So one of my own code-smells now is a prevalence of bidirectionality . Not that it should always be removed...of course not. But it might be an indicator of gray boundaries among my Aggregates in my Domain.

Posted on Thursday, August 24, 2006 1:03 PM Domain Driven Design (DDD) | Back to top

Comments on this post: The Aggregate Liberation

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Mike Nichols | Powered by: