Re: Should the "command" method do the validation?
| Newsgroups | gmane.comp.programming.domain-driven-design |
|---|---|
| Message-ID | <[email protected]> |
I'm not a CQRS expert, but I think Variation 3 is the best fit. Variation 2 I think is the worst because -- assuming your domain should not allow non-fitting bookings -- it allows the Event aggregate to get into an invalid state because someone *could* call add() *without* having first called fits(). I prefer Variation 3 because the fits() method is expose to allow books to be checked before someone commits to them, but still re-enforces that a booking fits when actually being added.