Re: Re: Domain-drive-design vs. Comman d pattern -- mutually exclusive?
"João Oliveira [email protected] [domaindrivendesign]" <[email protected]> Sun, 03 May 2015 00:01:20 +0000
| Newsgroups | gmane.comp.programming.domain-driven-design |
|---|---|
| Message-ID | <CAM_z20LCeQMctMch7yZDQ_mE15hsjpLchOEPDy_a9rCbAQAM-g@mail.gmail.com> |
Hi, This was a great advice. I've checked your link below and learned a few things. Thank you, *Joao Oliveira* *Software Engineer* *P:* +353 831 467 299 | *E: *[email protected] | Connect with me on Linkedin <http://ie.linkedin.com/in/jnicolau> On Thu, Apr 30, 2015 at 3:31 PM [email protected] [domaindrivendesign] <[email protected]> wrote: > > > 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/> > [image: image] > <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 > > > > > >