Re: Responsibilities of ApplicationServices versus DomainServices
Wim van Gool <[email protected]>
| Newsgroups | gmane.comp.programming.domain-driven-design |
|---|---|
| Message-ID | <CAKqMafw4WEsDHjECRNtVE7EvpNm1GtWFOe+XdArzeVoHJu8fHw@mail.gmail.com> |
*Infrastructural Services* *- *To send mail or otherwise communicate (out) to external systems. * * *Application Services* (aka MessageHandlers) - Live in the ApplicationLayer. - Know about and handle messages of any kind (commands and events, external and internal) - Never contain any business logic, but delegate to the domain(services) for this. - Translates message-property values to Domain-instances where required. - May have some form of exception-handling to handle/convert exceptions raised by the domain. *Domain Services* - Live in the DomainLayer - Know nothing about messages - only plain arguments. - Primarily used to coordinate several calls to aggregates in one transaction, which should be a rather scarce case. *Remaining questions*: - Which service would you use to implement adding/removing aggregates and raise the appropriate DomainEvent? On Mon, May 27, 2013 at 11:44 AM, Greg Young <[email protected]>wrote: > ** > > > Infrastructure service > > To send email > > > On Monday, May 27, 2013, Wim van Gool wrote: > >> ** >> >> >> Everybody knows ApplicationServices and DomainServices are different and >> have different responsibilities. Yet, I think it would be convenient to >> have a clear list of what things should typically be handled by each >> service-type and what not. I'll kick it off by my own thoughts on the >> matter and hope others will correct me or help me complete the list (or add >> some open questions). >> >> *ApplicationServices* (aka MessageHandlers) >> - Live in the ApplicationLayer. >> - Know about and handle messages of any kind (commands and events, >> external and internal) >> - Never contain any business logic, but delegate to the domain(services) >> for this. >> - Translates message-property values to Domain-instances where required. >> - May have some form of exception-handling to handle/convert exceptions >> raised by the domain. >> >> *DomainServices* >> - Live in the DomainLayer >> - Know nothing about messages - only plain arguments. >> - Primarily used to coordinate several calls to aggregates in one >> transaction, which should be a rather scarce case. >> >> *Remaining questions*: >> - Which service would you use to implement adding/removing aggregates and >> raise the appropriate DomainEvent? >> - Which service would you use to send an email or otherwise call external >> services? >> >> > > -- > Le doute n'est pas une condition agréable, mais la certitude est absurde. > > >