Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • Thanks. Are you saying that the application service layer should not access domain objects that are not an aggregate root? Commented Nov 7, 2017 at 16:18
  • Exactly. And that's mainly because the aggregate root need to be responsible for maintaining the invariants of the aggregate Commented Nov 7, 2017 at 16:24
  • Thanks. Is there a set of guidelines that can be used to design DDD classes? When designing databases you have Normalisation. Is there something similar for the Domain Classes? (which would perhaps show that Invoice is not a valid property of Customer and perhaps an aggregate root in its own right). Commented Nov 7, 2017 at 16:28
  • Do not fall in the ORM mindset trap: Aggregates often have a very different organisation of state/data than the schema structure, when such state gets persisted in a store/db. You use a Mapper for that (inside a Repository, when implementing its interface in the Application layer): with a mapper you can normalise your data before persisting it. — While for specific domain consistency rules (e.g. InvalidInvoice) you can use Invariants, inside the boundaries of the Aggregate. Commented Oct 31, 2024 at 2:15