Separates a domain operation’s precondition check from its execution while keeping both decisions in the domain model. A CanDo() method reports whether Do() may proceed; Do() enforces that result as a precondition. section 7.6 section 7.4
Balances three competing concerns:
- Keeps business decisions out of controllers, which can act on the domain model’s result. section 7.4
- Avoids unnecessary external reads when the operation is already known to be invalid. section 7.4
- Adds a separate decision step and therefore increases controller complexity rather than preserving maximum controller simplicity. section 7.6
Changing a confirmed email
Defines CanChangeEmail() to return an error when IsEmailConfirmed is true and null otherwise. The controller checks this method before loading Company; ChangeEmail() then requires the check to succeed before updating the user. If the email changes, the domain object can record an EmailChangedEvent for later notification.
