3

I am pretty new to DDD, so bear with me.

I have a Chat room and people in the Chat room. The people in the chat room need to propose a date they would like a webinar to be on. we have a bussiness rule, where we need to have at least 3 people in the webinar for the webinar to take place and each person interested in the webinar needs to say that they are ready for someone to propose a date

I have 2 solutions in mind

solution 1:

Making Chat room the aggregate root

Have a function propose date on the Chat room, ProposeDate(Person, Date).

In this solution I would validate the bussiness rules on the Chat room and set the date on person entity.

An issue With this solution is that we have a setter on the person entity that can be called from anywhere in the domain without the reference to the validation in the chat room, should the proposed date for each person actually be removed from the person entity and be set on the chat room itself so it cannot be set wihout calling chat room entity?

solution 2

Make person the aggregate root

On Person have ProposeDate(Date).and person would ask Chat room can i propose this date. The problem i have with this solution is I believe it invalidates the tell don't ask principle.

If i have it all wrong and there is another solution please let me know.

The people have to propose/accept/reject that date dates to each other.

2
  • If there are five people in the chat, do they have to come to an agreement on a date without seeing which dates the others have proposed, or can one of them propose a date and can the others accept/reject that date? Feb 6, 2015 at 16:00
  • 1
    is there a difference between webinar and chat room? seems to me like Webinar.AddDateProposal(DateProposal) would be correct?
    – Ewan
    May 14, 2015 at 11:33

1 Answer 1

3

When you have a situation like this where two objects seem interdependent, sometimes the solution is to refactor a dependency into third object. In this case why don't you have WebinarVote object with propose(ChatRoom, Person) method?

After the voting period is over, your Webinar (or whatever it is called now in your architecture) service object will iterate WebinarVotes to determine which webinars take place and which are not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.