1

I'm designing modules in web chess game and I feel confused in some case.

I've separated several modules (aggregates):

  1. Profile (id, name, photo, isActive)
  2. Ranking (id, value, list of ranking changes (date, ranking difference, opponent id))
  3. Purchases (id, money, list of puchase position (id, shopItemType, date))

It looks good because these aggregates are small, but it seems a bit artificial. Ranking and Purchases is one to one with Profile. All these three agregates seem to be one aggregate. If I delete Profile by id I have to delete Ranking and Purchases too.

If I created one aggregate (profile data, ranking data and purchases data) it would be too big (SRP ??).

Could you guys give me some advices ?

slim
  • 447
  • 2
  • 10
  • 27
Bambelal
  • 179
  • 1
  • 2
  • 13

1 Answers1

0

Your aggregates are not. They are just entities (and/or value objects).

"A DDD aggregate is a cluster of domain objects that can be treated as a single unit". Martin Fowler. So an aggregate must contains multiple entities or value objects with a root entity.

So, you can create an aggregate Profile containing Ranking and Purchase entities.

It all depends on the business sense of your aggregate.

slim
  • 447
  • 2
  • 10
  • 27