arioch022000 | 1 Mar 16:48
Picon

Re: Domain logic is mainly handled in Services?

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?
> > >
> >
>
__._,_.___

Your email settings: Individual Email|Traditional
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

__,_._,___
Udi Dahan | 3 Mar 11:21
Picon

Re: Domain logic is mainly handled in Services?

> 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.

 

I think it would be more accurate to say that the design of a distributed system should be different from one deployed on a single 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

 

Actually, I think that that’s your interpretation of the core requirement that external systems integrate with your system.

 

> Unfortunately, SOA means that the platform of a service client cannot be guaranteed

 

Why unfortunately? And, regardless of SOA, even 3/N-Tier didn’t necessarily assume the platform of the client.

 

> The domain objects often end up being the product of XML generation techniques, have very little domain logic, and are simply data carriers.

 

The fact that SOA makes heavy use of messaging and the data transfer object pattern does not negate the domain model pattern. It’s just that the client does not interact directly with persistent domain objects, although there’s no (SOA) reason not to use them in the service implementation.

 

> … has a very real impact on Domain Driven Design.

 

Not in my experience. Not if you have chunky business services. Not if you do SOA right. Business services encapsulate a domain – DDD provides a great deal of value inside business services.

 

Hope that helps.

 

> Re: Domain logic is mainly handled in Services?

> Posted by: "arioch022000" Thomasjeffreyandersontwin <at> Gmail.com   arioch022000

> Mon Mar 3, 2008 12:20 am (PST)

 

 

--
Udi Dahan - The Software Simplist
.NET Development Expert & SOA Specialist

__._,_.___

Your email settings: Individual Email|Traditional
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

__,_._,___

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.21.3/1307 - Release Date: 02/03/2008 15:59

randy stafford | 4 Mar 03:10
Picon
Favicon

RE: Re: Repository access

Richard I totally agree.  If a client calls on a domain object to discharge one of its responsibilities, and the domain object’s implementation of that responsibility requires it to collaborate with other aggregated or associated objects, I see absolutely no reason why that domain object should not gain access to those collaborators by using a Repository.  That is totally consistent with making a domain model implementation rich and expressive, and the opposite of “anemic”.  Besides, I have found that delegating to Repositories in the implementation of some responsibilities can be very beneficial from a performance and scalability perspective in mature production systems, as I have posted in this forum previously.

 

Well said, Richard.

 

Kind Regards,

Randy

 

 

From: domaindrivendesign <at> yahoogroups.com [mailto:domaindrivendesign <at> yahoogroups.com] On Behalf Of Richard Pawson
Sent: Monday, February 25, 2008 3:12 AM
To: domaindrivendesign <at> yahoogroups.com
Subject: [domaindrivendesign] Re: Repository access

 

It seems to me that if you are saying that a domain object (e.g. a
Customer) does not know about any Repository, then that domain object
cannot itself know how to get hold of other objects that it might
need access to (whether directly or indirectly associated with it).

Instead you seem to be saying that it is up to the client that is
using the Customer to get hold of the other objects and then process
them together if need be? What you end up with that way is good old-
fashioned separation of procedure and data i.e. the domain objects
are little more than data containers, and any behaviour that involves
processing anything other than the simple values held by a domain
object is shifted up into some kind of client (call it a 'process' or
whatever).

If I have misunderstood your point then I apologise, but please then
make it clear how, in your approach, an instance method on an object
can get hold of other objects (both directly associated with that
object and not) that it might have a legitimate reason to be
interested in.

Richard

__._,_.___

Your email settings: Individual Email|Traditional
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

__,_._,___
acqy_sunnychen | 4 Mar 03:19
Picon
Favicon

Re: Can UI Layer access Entities?

Yes, actually I didn't express my thought clearly. the userDomain 
appeared in my code stands for the meaning of "domain for user 
management", which is a facade for user management. In the 
userDomain.CreateUser function, the user would be constructed by the 
factory and be persisted by the repository.

I think I perfer Matthew Adams's opinion. UI elements SHOULD NOT 
access Domain Entities directly. This because entities are not of 
Anemic Domain Model, which means that there would be some domain 
related methods or functions in entities. If UI elements call the 
entities directly, it seems that the UI can access the domain logic 
directly, this breaks the "encapsulation" attribute of the domain 
layer.

So I think DTO would be a better solution here. 

--- In domaindrivendesign <at> yahoogroups.com, "david_torontonian" 
<david_torontonian@...> wrote:
>
> Unfortunately none of these approaches are really DDD(more close 
to 
> Anemic Domain Model). These are the issues:
> 
> 1.In DDD (unlike Anemic Domain Model) we don't separate data and 
> behaviors so there wouldn't be User and UserDomain. A single 
entity 
> would contain data and related behaviors.
> 
> 2.Repository persists the entities not domain object. So 
> userDomain.CreateUser is not correct
> 
> In my view, your code should look like this:
> 
> User user = new User();
> user.Username = "abc";
> user.Password = "def";
> UserRepository userRepository = new UserRepository();
> userRepository.Add(user);
> 
> --- In domaindrivendesign <at> yahoogroups.com, "acqy_sunnychen" 
> <acqy_sunnychen@> wrote:
> >
> > Can Entities be accessed by User Interface (Presentation) Layer?
> > 
> > I'm using ASP.NET
> > 
> > For example, When user clicks "Register" button on the Web UI, 
> there 
> > are two approaches listed below. Which one is correct?
> > 
> > 1. Create a User Entity object and pass it to the Create User 
> > business procedure:
> > 
> >  User user = new User();
> >  user.Username = "abc";
> >  user.Password = "def";
> >  UserDomain userDomain = new UserDomain();
> >  userDomain.CreateUser(user);
> > 
> > 2. Just pass the primitive data types to the business procedure 
and 
> > create the User object inside the business procedure:
> > 
> >  UserDomain userDomain = new UserDomain();
> >  userDomain.CreateUser("abc", "def"); // User object will be 
> created 
> > inside this call
> > 
> > 
> > I'm new to DDD and I don't know how to handle such situation. 
Could 
> > anyone help me?
> >
>

 
acqy_sunnychen | 4 Mar 03:48
Picon
Favicon

What's the relationship between SOA and DDD?

Firstly let me say sorry for my "stupid" question. Because I'm a newbie 
on SOA and DDD fields.

SOA is very hot in these years. But I think no matter what SOA is, it 
cannot escape from the Domain Logic. So I think SOA is mainly about 
enterprise application architecture and DDD, which pays close attention 
to the Domain Model and Domain Logic, is the basis of SOA.

 
arioch022000 | 4 Mar 04:16
Picon

Re: What's the relationship between SOA and DDD?

I think it's important to explore this question, it's certainly not 
a stupid one.
I've also posted the question at the following...
http://tech.groups.yahoo.com/group/domaindrivendesign/message/7005

SOA does cover enterprise application concerns, but it does so by 
making business logic, business interfaces, and business messages a 
first-class IT asset that is managed, monitored and maintained that 
like other IT infrastructure.  DDD is an excellent way to model and 
implement these business centric assets.

The problem I have with looking at SOA and DDD is that DDD seems to 
apply a lot of object oriented approaches (which I think are 
excellent IMHO) that do not necessarily translate well to SOA.  
Objects with robust self encapsulated behavior being one of them.
Jeff
http://agileconsulting.blogspot.com/

--- In domaindrivendesign <at> yahoogroups.com, "acqy_sunnychen" 
<acqy_sunnychen@...> wrote:
>
> Firstly let me say sorry for my "stupid" question. Because I'm a 
newbie 
> on SOA and DDD fields.
> 
> SOA is very hot in these years. But I think no matter what SOA is, 
it 
> cannot escape from the Domain Logic. So I think SOA is mainly 
about 
> enterprise application architecture and DDD, which pays close 
attention 
> to the Domain Model and Domain Logic, is the basis of SOA.
>

 
acqy_sunnychen | 4 Mar 07:46
Picon
Favicon

Should DTOs maintain the object relations?

Should DTOs maintain the object relations? For example if I have two 
Entities: User and Forum. A user could be the moderator of several 
Forums, and a Forum of course may have several moderators(users to 
manage this forum). This bidirectional relationship could be maintained 
within the domain model but if I create the DTOs for these entities, do 
I still need to maintain such relation? It seems a little redundance to 
do so.

 
acqy_sunnychen | 4 Mar 09:29
Picon
Favicon

Re: Should DTOs maintain the object relations?

Another post that seems to be related to my question is here:

http://geekswithblogs.net/opiesblog/archive/2006/08/18/88396.aspx

please also take a reference to this post.

Thanks a lot!

--- In domaindrivendesign <at> yahoogroups.com, "acqy_sunnychen" 
<acqy_sunnychen@...> wrote:
>
> Should DTOs maintain the object relations? For example if I have two 
> Entities: User and Forum. A user could be the moderator of several 
> Forums, and a Forum of course may have several moderators(users to 
> manage this forum). This bidirectional relationship could be 
maintained 
> within the domain model but if I create the DTOs for these entities, 
do 
> I still need to maintain such relation? It seems a little redundance 
to 
> do so.
>

 
Zdeslav Vojkovic | 4 Mar 10:37
Picon
Gravatar

Re: Should DTOs maintain the object relations?

On Tue, Mar 4, 2008 at 7:46 AM, acqy_sunnychen <acqy_sunnychen <at> yahoo.com> wrote:
> Should DTOs maintain the object relations? For example if I have two
>  Entities: User and Forum. A user could be the moderator of several
>  Forums, and a Forum of course may have several moderators(users to
>  manage this forum). This bidirectional relationship could be maintained
>  within the domain model but if I create the DTOs for these entities, do
>  I still need to maintain such relation? It seems a little redundance to
>  do so.

If the clients of DTO have no use for such a relationship, I don't see
why you would have to implement it. In my experience, even when I have
bidirectional relations in domain (and I try to avoid it, if
possible), in most cases it doesn't need to be reflected in DTOs, so I
don't do it.

 

Re: Asynchronous Repositories

Hi,

thx for your suggestion Greg. Implementing an observer mechanism is a trivial task since it is pretty much baked into the language we are using so that certainly works out.

However, I have put some more thought into this. Would it be correct to assume that repositories don't make much sense if you are dealing with async remote calls? Or should I say that async data fetching is a problem not currently addressed by DDD? Quoting Eric Evans in the DDD book (p. 157): "The client of a REPOSITORY should be given the illusion that the objects are in memory.". That being said, it is no problem to call a method on a repository and have it return the objects immediately if the objects are in memory. But, if the objects are sent back asynchronously, the whole point of e ncapsulating that behavior is gone since you the client needs to "listen" for a response on the repository. So it knows about the implementation details of the repository.

Any thoughts?

regards,
Christophe

2008/2/21, Greg Young <gregoryyoung1 <at> gmail.com>:

The async pattern (Begin/End) is quite useful for this situation but
it needs function pointers/delegates to work. You could make a slight
modification to the pattern and pass in an interface with a single
method (handle data) or even just implement an observer.

Cheers,

Greg

On Wed, Feb 20, 2008 at 8:21 AM, Christophe Herreman
<lists <at> herrodius.com> wrote:
>
>
>
>
>
>
> Hi all,
>
> we're currently working on a rich client in Flex (ActionScript 3) that
> uses Remoting to fetch server side data (the server layer is written
> in .net). Since all of this communication happens asynchronously, it
> seems that we would need a different approach on creating repositories.
>
> For instance, let's say we have a UserRepository with a loadAll()
> method. We can't assign the result directly to a variable like...
>
> var users:ArrayCollection = userRepository.loadAll();
>
> ...but instead we would have to handle this with an event mechanism
> that notifies us when the data is received.
>
> I was wondering if anyone has experience with this problem and would
> to share thoughts or solutions for this situation or async behavior in
> general.
>
> regards,
> Christophe
>
>

--
Studying for the Turing test




--
Christophe Herreman
http://www.herrodius.com
http://www.pranaframework.org __._,_.___

Your email settings: Individual Email|Traditional
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

__,_._,___

Gmane