modular-monolith-with-ddd icon indicating copy to clipboard operation
modular-monolith-with-ddd copied to clipboard

Ambiguous `_location` in MeetingGroup

Open shamil-sadigov opened this issue 3 years ago • 1 comments

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

shamil-sadigov avatar Apr 28 '21 10:04 shamil-sadigov

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.

kgrzybek avatar Jun 08 '21 20:06 kgrzybek