Help on defining aggregates using DDD
Hi, I'm working on a mini project for a spa management system in which I would like to familiarize myself with the concept of DDD (Domain-Driven Design). I have a general understanding of it, but I'm having trouble defining what should be an aggregate and what should not. Currently, I anticipate having the following classes in the system: Employee, Customer, Service, Salon, Product, Appointment, Sale, Invoice, Report, Schedule, Payment. Could someone guide me on which classes should be aggregates in this case? Thank you in advance for your help.
7 Replies
it's all the stuff together for the feature*/operation you need
-# * although this is more of a vsa terminology
Not really? Aggregates have a specific definition
i make use of abp, and their definition is here
https://abp.io/docs/latest/framework/architecture/domain-driven-design/entities
but i have seen multiple
OP said DDD, which I'm assuming is the book by Evans
Although that definition looks in line with what I remember by Evans
I understand the basic principles, but my issue is that in my system, the Administrator can create one (or several) Salons and then add employees, accounts for employees, services, products, clients, schedules, etc. When trying to define aggregates, it seems that I actually have one aggregate, the Salon, from which I can add and manage individual elements. If I were to break this down into several aggregates, I would have, for example, Salon, Employee, Reservation, but then the Salon aggregate would contain other aggregates, and I’m not sure if this is good practice.
what do you mean by "breaking it down into sevel aggregates", why do that
I wanted to split it into smaller aggregates, because each of the elements (e.g. Employee, Reservation) has its own rules and life cycle. It seems to me that such an approach would allow for better management of business logic and transactions for each of these elements separately, instead of keeping everything in one aggregate Salon. Besides, I don't know, I'm really getting confused