Re: Domain logic is mainly handled in Services?
2008-03-01 15:48:40 GMT
This is a really interesting topic, and there have been a lot of good comments. However, no one has brought up the issue concerning the reality that the model for a distributed system often needs to be very different from the model used for a system that's only going to be deployed on one machine. Often there is a requirement for domain logic to be packaged into one or more services that can be exposed in an enterprise, interoperable way. I'm seeing many clients of mine turn to SOA as an answer, not just vanilla OO solutions.
There are many benefits to SOA, implemented properly, SOA can deliver platform interoperability, document centric assets (services and their operations) that can be governed, versioned, and managed on a large scale, standard based messaging (a la SWIFT, IFX, etc.), the list goes on. Unfortunately, SOA means that the platform of a service client cannot be guaranteed. The domain objects often end up being the product of XML generation techniques, have very little domain logic, and are simply data carriers.
While I agree that conceptually domain logic should typically belong on the domain entity, this is difficult to achieve while guaranteeing platform interoperability. In an SOA one typically ends up with the procedural like mechanism of passing data to operations. And I'm seeing some form of SOA being implemented in most large scale solutions I come across in typical industries like banks, telecommunications, financial services, et cetera. I hope I'm not coming off as one of those SOA zealots, I'm simply trying to point out that this stuff is very real, and has a very real impact on Domain Driven Design.
I've still managed to follow many domain driven design principles on SOA projects, but some sacrifices were required. I would be interested to hear any other comments or experiences on using DDD and SOA together.
--- In domaindrivendesign <at> yahoogroups.com, "david_torontonian" <david_torontonian <at> ...> wrote:
>
> Thanks Richard! You explained it very well.
>
> --- In domaindrivendesign <at> yahoogroups.com, "kaushik_spock"
> kaushik.spock <at> wrote:
> >
> > Domain logic belongs in entities and domain layer services. The
> > services in application layer would not have any domain logic in
> > them.
> >
> > The thumb rule i am trying to use for deciding where logic should
> > reside is this
> > - If you can't think of a logical owner(entity) for the behaviour
> > put it as a service
> > - If your domain logic affects entities across 2 or more
> aggregate s,
> > then have the services act as orchestrator which calls methods in
> > entities that act on themselves and do pieces of the logic
> > - If your domain logic affects entities only within an aggregate,
> > then the root of aggregate should act as orchestrator
> >
> > However i am very new to DDD and this is my initial thoughts on how
> > to do it.
> >
> > Thanks,
> > Kaushik
> >
> > > The thing that confusing me much is that, which role described in
> > DDD
> > > handles the domain logic (or business logic), the Services?
> > >
> >
>
__._,_.___
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
__,_._,___
RSS Feed