Skip to content

Instantly share code, notes, and snippets.

@dlidstrom
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlidstrom/b8769f607edb44a515d2 to your computer and use it in GitHub Desktop.
Save dlidstrom/b8769f607edb44a515d2 to your computer and use it in GitHub Desktop.
Domain Driven Design Guidelines
  • Aggregate roots should not refer to any other aggregate roots, even in the constructor. Only the id of related aggregate roots is allowed.
  • Constructors can only accept ids and value types.
  • No setter properties are allowed. Use only methods for mutating state.
  • All business rules should be coded in the aggregate roots. Querying is the only type of "business rules" that are allowed outside of aggregate roots.
  • Use domain events to signal events in the domain. This is how related aggregate roots can get notified of what happens in other aggregate roots.
  • Log all non-standard exits from aggregate root methods. For example, return statements in the middle must have a logging statement that explains the decision to exit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment