Re: Responsibilities of ApplicationServices versus DomainServices
Greg Young <[email protected]>
| Newsgroups | gmane.comp.programming.domain-driven-design |
|---|---|
| Message-ID | <CAC9RQtgyPwmK8CA+h_+jGn7+FPzMvRpp5Gi9+9n8Zpdzim3xQw@mail.gmail.com> |
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.