kgrzybek / modular-monolith-with-ddd

Full Modular Monolith application with Domain-Driven Design approach.
MIT License
10.89k stars 1.71k forks source link

Ambiguous `_location` in MeetingGroup #199

Open shamil-sadigov opened 3 years ago

shamil-sadigov commented 3 years ago

Hi, Kamil!

Here, when we create Meeting we specify the location. MeetingGroup in turn also has _location which is not used anywhere, so I wonder, what sense does it make to have _location in MeetingGroup considering that we don't use it and specify other location when creating Meeting? 🤔

https://github.com/kgrzybek/modular-monolith-with-ddd/blob/37de06228f3f6f49de20a510d5349c784903b01f/src/Modules/Meetings/Domain/MeetingGroups/MeetingGroup.cs#L96-L123

kgrzybek commented 3 years ago

Hi @shamil-sadigov

As far as I remember, in Meetup application, you have a location for a Meeting Group and for particular Meetings.

Location from Meeting Group is used in the Read Model: https://github.com/kgrzybek/modular-monolith-with-ddd/blob/548c1c28d597fa4b7f675f211cb045e5d9e0b067/src/Modules/Meetings/Application/MeetingGroups/GetAllMeetingGroups/MeetingGroupDto.cs

One note: According to DDD Aggregate definition you should not have attributes which are not used to protect business invariants. This is that case and location should be moved outside the aggregate. However, I am not such a orthodox and sometimes I keep more data in an aggregate if it does not affect performance and causes concurrency issues.