Reputation: 143
I'm reading Implementing Domain Driven Design book of Vaughn Vernon. But I soon get into trouble for modeling aggregates in my domain - football matches.
My case is list all matches based on some conditions (filters), for ex:
As I see a league (ex. World Cup) will have many stages such as group stage or knockout stage.
A stage will have many rounds, ex. Round of 16, Quarter-finals, etc.
A round will have many matches.
However, some leagues do not have stage, ex. Premier League. Even Friendly International leagues do not have both stage and round.
First solution:
We will have 4 aggregates:
For leagues do not have Stage or Round, a special identifier will be created for Stage and Round, ex. NO_STAGE or NO_ROUND
Second solution:
League will contain Matches. Stage or Round are just attributes (Value Objects) of Match
Third solution:
Create all types of League:
Upvotes: 1
Views: 87
Reputation: 7744
The underlying problem is, that you are trying to model data instead of behavior. You are creating a relational model (what contains what, one-to-one, one-to-many, etc.), not an object model. Modeling data is meaningless without a context of what functionality it must support.
If you do only want a data model, then DDD is irrelevant since that is not a data modelling technique.
I assume you want to build object-oriented software though. In this case, approach the problem by identifying what functionality you want from your software, and model that.
For example: schedule matches, prepare/display a calendar of events, simulate progression, etc.
Upvotes: 1