Re: Domain-drive-design vs. Comma n d pattern — mutually exclusive?
| Newsgroups | gmane.comp.programming.domain-driven-design |
|---|---|
| Message-ID | <[email protected]> |
Hi Hope I undersand you correctly. Commands in DDD and CQRS is normally simple DTO's no behavior but simple data. But CommandHandlers Retireve the AggregateRoot that The Command is Supposed to Mutate. You can then invoke a method on the AggregateRoot Taking the command or some data of the command as argument. Its the responsibility of the aggragate root to check that all Domain rules are followed. It is the responsibility of the CommandHandler to retrieve the AggregateRoot, invoke a aggregateRoot method and save the aggregate root state. If you use Domain events. Which I would highly recommend. The commandhandler can raise Domain events and publish them using a messageDispatcher. You can choose to model commandHandlers as standalone classes handling one command or you can choose to let a handling class handle multiple different commands. Other exiting variations exists when implementing event sourcing. Try to study Rinat Abdullin, Greg Young but also Jan Kronquist Don't publish Domain Events, return them! - Jayway http://www.jayway.com/2013/06/20/dont-publish-domain-events-return-them/ http://www.jayway.com/2013/06/20/dont-publish-domain-events-return-them/ Don't publish Domain Events, return them! - Jayway http://www.jayway.com/2013/06/20/dont-publish-domain-events-return-them/ During a discussion around some of the code examples in Vaugn Vernon’s book Implementing Domain Driven Design we got stuck at what first appeared to be a ... View on www.jayway.com http://www.jayway.com/2013/06/20/dont-publish-domain-events-return-them/ Preview by Yahoo