jeudi 9 mars 2017

DDD Choosing Aggregate Roots

Building a time tracking application I am trying to determine the best way to design the aggregate roots.

The basic core entities are Client, Project, Employee, ProjectAssignment, Department, Timesheet. A Client has one or more projects, a project has one or more employees assigned to it (via ProjectAssignment), an Employee belong to a department, and Timesheet links Project, Employee together.

Client seems like an obvious aggregate root.

Client -> Project -> ProjectAssignment -> Employee

Regarding the other aggregates I'm kind of not sure what the best way to go would be...

I was thinking...

Department -> Employee -> Person

Or have Employee and Department as separate aggregates entirely. Employees can be in one department and one department only. However department is self referencing to create a department hierarchy.

How do you deal with entities being shared between aggregate roots?

Aucun commentaire:

Enregistrer un commentaire