Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

domaindrivendesign · Domain-Driven Design

The Yahoo! Groups Product Blog

Check it out!

Group Information

  • Members: 4073
  • Category: Software
  • Founded: Sep 27, 2002
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Messages

Advanced
Messages Help
Messages 8673 - 8702 of 24070   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#8673 From: "Patrik Nordwall" <patrik_nordwall@...>
Date: Sat Nov 1, 2008 1:22 pm
Subject: Sculptor port of DDD sample
patrik_nordwall
Send Email Send Email
 
Have you seen the DDD sample: http://dddsample.sourceforge.net/
I have ported it to Sculptor. It is a really nice sample, since is based on
something real, and
complicated - the cargo domain used in Eric Evans' book. It was a good exercise
to port it to
Sculptor. Not very difficult, since Sculptor was designed with the DDD concepts
from the
beginning. I think it is a nice illustration of how to combine hand written code
for the
business logic with the automatically generated pieces provided by Sculptor.

http://fornax-platform.org/cp/x/RQk

#8674 From: "Jeremy Wiebe" <jeremy.wiebe@...>
Date: Sun Nov 2, 2008 3:46 am
Subject: Managing relationships to objects not part of an aggregate root
jeremyjtwiebe
Send Email Send Email
 
Hi there,

In my attempts to apply DDD lately I've been struggling with how to represent relationships to entities that are not part of an aggregate root. 

Do you:
a) just have an ID in an entity and let the application services follow that ID and load the associated entity with it's repository
or
b)  include a "scaled-down" representation of the related entity so that the application doesn't have to go and load the related aggregate root

Example:
Let's say we're dealing with white-labeled insurance products.  Within that I have a Brand which has insurance products.  Each Brand has customers who have policies based on a product.

Now, so far we've identified the Brand as an aggregate root with it's products.  This allows us to edit the Brand, etc.  We also have customer as an aggregate root. 

When we load the Customer we want to display what Brand they are linked to (just name and logo).  It seems very over-board to have to load the entire Brand aggregate root just to display it's name and logo.

Am I missing something (or is there a part of Eric Evans book that I've missed that I could reference?)

--
Jeremy Wiebe
jeremy.wiebe@...

#8675 From: Justin Daubenmire <jdaubenm@...>
Date: Mon Nov 3, 2008 8:31 pm
Subject: difference between value objects and dto
JDaubenm
Send Email Send Email
 
All,

I recently came across a project that was using ddd and I seen value objects and
data transfer objects (dtos) in the project. My question is this, what is the
difference between value objects and dtos? Aren't they really the same thing?
value objects are non-mutable and so are dto objects.

Thanks for any clarification!

Justin

#8676 From: "Greg Young" <gregoryyoung1@...>
Date: Mon Nov 3, 2008 9:27 pm
Subject: Re: difference between value objects and dto
gumboismadeo...
Send Email Send Email
 
immutability is a property they both tend to share but they have very
different intents.

Value objects are used to abstract a concept
DTOs are used to transfer data between layers or tiers

Example: I would use a money object to abstract and represent the
concept of *money* in my system. One benefit of doing this is that I
can insure validty of the data inside (imagine that my concept of
"Money" does not allow for a negative value or for fractional pennies
my Money value object can insure these invariants).

DTOs on the other hand are generally used as thin object to pass data
between layers or tiers.

Cheers,

Greg

On Mon, Nov 3, 2008 at 12:31 PM, Justin Daubenmire <jdaubenm@...> wrote:
> All,
>
> I recently came across a project that was using ddd and I seen value objects
> and data transfer objects (dtos) in the project. My question is this, what
> is the difference between value objects and dtos? Aren't they really the
> same thing? value objects are non-mutable and so are dto objects.
>
> Thanks for any clarification!
>
> Justin
>
>



--
It is the mark of an educated mind to be able to entertain a thought
without accepting it.

#8677 From: "Greg Young" <gregoryyoung1@...>
Date: Mon Nov 3, 2008 9:32 pm
Subject: Re: Managing relationships to objects not part of an aggregate root
gumboismadeo...
Send Email Send Email
 
I would say that you are correct that they are in different aggregate roots.

Instead of getting at them through traversal what if you were to introduce

BrandRepository::GetForCustomer(Customer)

etc ..




but more generally in this type of scenario I would point to a need of
command and query separation. The data you are looking for about a
"Brand" is for all intensive purposes a report... Need it even come
from your "domain model"?

I have a few posts in this group in the past on "Command and Query
Separation" that you can probably search for to obtain a more detailed
response.

Cheers,

Greg
On Sat, Nov 1, 2008 at 7:46 PM, Jeremy Wiebe <jeremy.wiebe@...> wrote:
> Hi there,
>
> In my attempts to apply DDD lately I've been struggling with how to
> represent relationships to entities that are not part of an aggregate root.
>
> Do you:
> a) just have an ID in an entity and let the application services follow that
> ID and load the associated entity with it's repository
> or
> b)  include a "scaled-down" representation of the related entity so that the
> application doesn't have to go and load the related aggregate root
>
> Example:
> Let's say we're dealing with white-labeled insurance products.  Within that
> I have a Brand which has insurance products.  Each Brand has customers who
> have policies based on a product.
>
> Now, so far we've identified the Brand as an aggregate root with it's
> products.  This allows us to edit the Brand, etc.  We also have customer as
> an aggregate root.
>
> When we load the Customer we want to display what Brand they are linked to
> (just name and logo).  It seems very over-board to have to load the entire
> Brand aggregate root just to display it's name and logo.
>
> Am I missing something (or is there a part of Eric Evans book that I've
> missed that I could reference?)
>
> --
> Jeremy Wiebe
> jeremy.wiebe@...
>
>



--
It is the mark of an educated mind to be able to entertain a thought
without accepting it.

#8678 From: "jasonmeckley" <jasonmeckley@...>
Date: Mon Nov 3, 2008 9:58 pm
Subject: Re: difference between value objects and dto
jasonmeckley
Send Email Send Email
 
to expand (or simplify?) what Greg said.
Value objects usually contain smarts (logic). with the money example
you could use a simple float type like
Float money = 1.20;

any logic performed on that will be exposed to whatever object uses
it. A value object of money would encapsulate that logic to ensure it
is always used correctly.

Money money = new Money(120);
Money newValue = money.Add(new Money(300));
or
Money euro = new Money(120, Currency.UsDollar).ExchangeTo(Currency.Euro);

DTO do not contain logic. they pass values from one layer to the next.
this is common with messaging and presentation.

--- In domaindrivendesign@yahoogroups.com, "Greg Young"
<gregoryyoung1@...> wrote:
>
> immutability is a property they both tend to share but they have very
> different intents.
>
> Value objects are used to abstract a concept
> DTOs are used to transfer data between layers or tiers
>
> Example: I would use a money object to abstract and represent the
> concept of *money* in my system. One benefit of doing this is that I
> can insure validty of the data inside (imagine that my concept of
> "Money" does not allow for a negative value or for fractional pennies
> my Money value object can insure these invariants).
>
> DTOs on the other hand are generally used as thin object to pass data
> between layers or tiers.
>
> Cheers,
>
> Greg
>
> On Mon, Nov 3, 2008 at 12:31 PM, Justin Daubenmire <jdaubenm@...> wrote:
> > All,
> >
> > I recently came across a project that was using ddd and I seen
value objects
> > and data transfer objects (dtos) in the project. My question is
this, what
> > is the difference between value objects and dtos? Aren't they
really the
> > same thing? value objects are non-mutable and so are dto objects.
> >
> > Thanks for any clarification!
> >
> > Justin
> >
> >
>
>
>
> --
> It is the mark of an educated mind to be able to entertain a thought
> without accepting it.
>

#8679 From: "Justin Daubenmire" <jdaubenm@...>
Date: Mon Nov 3, 2008 11:06 pm
Subject: Re: Re: difference between value objects and dto
JDaubenm
Send Email Send Email
 
Thanks guys for the clarification... it now has "clicked"!

Regards,
Justin
----- Original Message -----
From: "jasonmeckley" <jasonmeckley@...>
To: <domaindrivendesign@yahoogroups.com>
Sent: Monday, November 03, 2008 4:58 PM
Subject: [domaindrivendesign] Re: difference between value objects and dto


> to expand (or simplify?) what Greg said.
> Value objects usually contain smarts (logic). with the money example
> you could use a simple float type like
> Float money = 1.20;
>
> any logic performed on that will be exposed to whatever object uses
> it. A value object of money would encapsulate that logic to ensure it
> is always used correctly.
>
> Money money = new Money(120);
> Money newValue = money.Add(new Money(300));
> or
> Money euro = new Money(120, Currency.UsDollar).ExchangeTo(Currency.Euro);
>
> DTO do not contain logic. they pass values from one layer to the next.
> this is common with messaging and presentation.
>
> --- In domaindrivendesign@yahoogroups.com, "Greg Young"
> <gregoryyoung1@...> wrote:
>>
>> immutability is a property they both tend to share but they have very
>> different intents.
>>
>> Value objects are used to abstract a concept
>> DTOs are used to transfer data between layers or tiers
>>
>> Example: I would use a money object to abstract and represent the
>> concept of *money* in my system. One benefit of doing this is that I
>> can insure validty of the data inside (imagine that my concept of
>> "Money" does not allow for a negative value or for fractional pennies
>> my Money value object can insure these invariants).
>>
>> DTOs on the other hand are generally used as thin object to pass data
>> between layers or tiers.
>>
>> Cheers,
>>
>> Greg
>>
>> On Mon, Nov 3, 2008 at 12:31 PM, Justin Daubenmire <jdaubenm@...> wrote:
>> > All,
>> >
>> > I recently came across a project that was using ddd and I seen
> value objects
>> > and data transfer objects (dtos) in the project. My question is
> this, what
>> > is the difference between value objects and dtos? Aren't they
> really the
>> > same thing? value objects are non-mutable and so are dto objects.
>> >
>> > Thanks for any clarification!
>> >
>> > Justin
>> >
>> >
>>
>>
>>
>> --
>> It is the mark of an educated mind to be able to entertain a thought
>> without accepting it.
>>
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>

#8680 From: "Justin Daubenmire" <jdaubenm@...>
Date: Mon Nov 3, 2008 11:26 pm
Subject: question on layers in a project
JDaubenm
Send Email Send Email
 
Hi All,

I am looking over a few tutorials by Jean-Paul Boodhoo. I'm not sure if
everyone knows of him, but in his c#.net solution he has defined some
projects that I cannot determine what layer they belong to with regards to
ddd. I was wondering if anyone could share some ideas on it.

It is my understanding that ddd layers are: UI, Application, domain, and
infrastructure.

Here are two projects that I am seeing in his solution:

.Task
.Utility

At a high level, does anyone have any ideas on what these two projects are
used for and also, what ddd layer do they belong to?

Thanks!

Regards,
Justin

#8681 From: "Justin Daubenmire" <jdaubenm@...>
Date: Tue Nov 4, 2008 12:52 am
Subject: Re: difference between value objects and dto
JDaubenm
Send Email Send Email
 
Greg/All,

Is it ok then to include business rules directly within value objects? For
example,

if (money < 0)
{
// don't allow it
}

or...

are business rules to be in their own classes outside of value objects?

How do most handle the business rules?

Thanks!

Regards,
Justin
----- Original Message -----
From: "Greg Young" <gregoryyoung1@...>
To: <domaindrivendesign@yahoogroups.com>
Sent: Monday, November 03, 2008 4:27 PM
Subject: Re: [domaindrivendesign] difference between value objects and dto


> immutability is a property they both tend to share but they have very
> different intents.
>
> Value objects are used to abstract a concept
> DTOs are used to transfer data between layers or tiers
>
> Example: I would use a money object to abstract and represent the
> concept of *money* in my system. One benefit of doing this is that I
> can insure validty of the data inside (imagine that my concept of
> "Money" does not allow for a negative value or for fractional pennies
> my Money value object can insure these invariants).
>
> DTOs on the other hand are generally used as thin object to pass data
> between layers or tiers.
>
> Cheers,
>
> Greg
>
> On Mon, Nov 3, 2008 at 12:31 PM, Justin Daubenmire <jdaubenm@...>
> wrote:
>> All,
>>
>> I recently came across a project that was using ddd and I seen value
>> objects
>> and data transfer objects (dtos) in the project. My question is this,
>> what
>> is the difference between value objects and dtos? Aren't they really the
>> same thing? value objects are non-mutable and so are dto objects.
>>
>> Thanks for any clarification!
>>
>> Justin
>>
>>
>
>
>
> --
> It is the mark of an educated mind to be able to entertain a thought
> without accepting it.
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>

#8682 From: Yim Carfield <carfield@...>
Date: Tue Nov 4, 2008 1:18 am
Subject: Re: Managing relationships to objects not part of an aggregate root
c8133594
Send Email Send Email
 
I think it is really not necessary to load all data if what you really need is the name. We don't have to return an domain object all the time even we are applying DDD

Sent from my iPhone

On Nov 2, 2008, at 11:46 AM, "Jeremy Wiebe" <jeremy.wiebe@...> wrote:

Hi there,

In my attempts to apply DDD lately I've been struggling with how to represent relationships to entities that are not part of an aggregate root. 

Do you:
a) just have an ID in an entity and let the application services follow that ID and load the associated entity with it's repository
or
b)  include a "scaled-down" representation of the related entity so that the application doesn't have to go and load the related aggregate root

Example:
Let's say we're dealing with white-labeled insurance products.  Within that I have a Brand which has insurance products.  Each Brand has customers who have policies based on a product.

Now, so far we've identified the Brand as an aggregate root with it's products.  This allows us to edit the Brand, etc.  We also have customer as an aggregate root. 

When we load the Customer we want to display what Brand they are linked to (just name and logo).  It seems very over-board to have to load the entire Brand aggregate root just to display it's name and logo.

Am I missing something (or is there a part of Eric Evans book that I've missed that I could reference?)

--
Jeremy Wiebe
jeremy.wiebe@gmail.com


#8683 From: "jasonmeckley" <jasonmeckley@...>
Date: Tue Nov 4, 2008 2:40 am
Subject: Re: difference between value objects and dto
jasonmeckley
Send Email Send Email
 
ultimately it depends on the complexity of the rules. then
encapsulating the rules within the Money object itself is perfectly
valid.  You could also create a BusinessRules object which is passed
to the Money object in the ctor/setter property to validate the values.

--- In domaindrivendesign@yahoogroups.com, "Justin Daubenmire"
<jdaubenm@...> wrote:
>
> Greg/All,
>
> Is it ok then to include business rules directly within value
objects? For
> example,
>
> if (money < 0)
> {
> // don't allow it
> }
>
> or...
>
> are business rules to be in their own classes outside of value objects?
>
> How do most handle the business rules?
>
> Thanks!
>
> Regards,
> Justin
> ----- Original Message -----
> From: "Greg Young" <gregoryyoung1@...>
> To: <domaindrivendesign@yahoogroups.com>
> Sent: Monday, November 03, 2008 4:27 PM
> Subject: Re: [domaindrivendesign] difference between value objects
and dto
>
>
> > immutability is a property they both tend to share but they have very
> > different intents.
> >
> > Value objects are used to abstract a concept
> > DTOs are used to transfer data between layers or tiers
> >
> > Example: I would use a money object to abstract and represent the
> > concept of *money* in my system. One benefit of doing this is that I
> > can insure validty of the data inside (imagine that my concept of
> > "Money" does not allow for a negative value or for fractional pennies
> > my Money value object can insure these invariants).
> >
> > DTOs on the other hand are generally used as thin object to pass data
> > between layers or tiers.
> >
> > Cheers,
> >
> > Greg
> >
> > On Mon, Nov 3, 2008 at 12:31 PM, Justin Daubenmire <jdaubenm@...>
> > wrote:
> >> All,
> >>
> >> I recently came across a project that was using ddd and I seen value
> >> objects
> >> and data transfer objects (dtos) in the project. My question is
this,
> >> what
> >> is the difference between value objects and dtos? Aren't they
really the
> >> same thing? value objects are non-mutable and so are dto objects.
> >>
> >> Thanks for any clarification!
> >>
> >> Justin
> >>
> >>
> >
> >
> >
> > --
> > It is the mark of an educated mind to be able to entertain a thought
> > without accepting it.
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> >
> >
>

#8684 From: "Justin Daubenmire" <jdaubenm@...>
Date: Tue Nov 4, 2008 12:50 pm
Subject: Re: Re: difference between value objects and dto
JDaubenm
Send Email Send Email
 
If the complexity of the rules were steep, would you personally place the
business rules in the money object? or in a business rules object and pass
that into the money object?

More less just looking for personal opinions on how steep/complex business
rules are handled - understanding that everyone would handle it differently
but...

Thanks!

Regards,
Justin
----- Original Message -----
From: "jasonmeckley" <jasonmeckley@...>
To: <domaindrivendesign@yahoogroups.com>
Sent: Monday, November 03, 2008 9:40 PM
Subject: [domaindrivendesign] Re: difference between value objects and dto


> ultimately it depends on the complexity of the rules. then
> encapsulating the rules within the Money object itself is perfectly
> valid.  You could also create a BusinessRules object which is passed
> to the Money object in the ctor/setter property to validate the values.
>
> --- In domaindrivendesign@yahoogroups.com, "Justin Daubenmire"
> <jdaubenm@...> wrote:
>>
>> Greg/All,
>>
>> Is it ok then to include business rules directly within value
> objects? For
>> example,
>>
>> if (money < 0)
>> {
>> // don't allow it
>> }
>>
>> or...
>>
>> are business rules to be in their own classes outside of value objects?
>>
>> How do most handle the business rules?
>>
>> Thanks!
>>
>> Regards,
>> Justin
>> ----- Original Message -----
>> From: "Greg Young" <gregoryyoung1@...>
>> To: <domaindrivendesign@yahoogroups.com>
>> Sent: Monday, November 03, 2008 4:27 PM
>> Subject: Re: [domaindrivendesign] difference between value objects
> and dto
>>
>>
>> > immutability is a property they both tend to share but they have very
>> > different intents.
>> >
>> > Value objects are used to abstract a concept
>> > DTOs are used to transfer data between layers or tiers
>> >
>> > Example: I would use a money object to abstract and represent the
>> > concept of *money* in my system. One benefit of doing this is that I
>> > can insure validty of the data inside (imagine that my concept of
>> > "Money" does not allow for a negative value or for fractional pennies
>> > my Money value object can insure these invariants).
>> >
>> > DTOs on the other hand are generally used as thin object to pass data
>> > between layers or tiers.
>> >
>> > Cheers,
>> >
>> > Greg
>> >
>> > On Mon, Nov 3, 2008 at 12:31 PM, Justin Daubenmire <jdaubenm@...>
>> > wrote:
>> >> All,
>> >>
>> >> I recently came across a project that was using ddd and I seen value
>> >> objects
>> >> and data transfer objects (dtos) in the project. My question is
> this,
>> >> what
>> >> is the difference between value objects and dtos? Aren't they
> really the
>> >> same thing? value objects are non-mutable and so are dto objects.
>> >>
>> >> Thanks for any clarification!
>> >>
>> >> Justin
>> >>
>> >>
>> >
>> >
>> >
>> > --
>> > It is the mark of an educated mind to be able to entertain a thought
>> > without accepting it.
>> >
>> > ------------------------------------
>> >
>> > Yahoo! Groups Links
>> >
>> >
>> >
>>
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>

#8685 From: "jasonmeckley" <jasonmeckley@...>
Date: Tue Nov 4, 2008 2:27 pm
Subject: Re: difference between value objects and dto
jasonmeckley
Send Email Send Email
 
the latter. here is one take on the model
http://www.lostechies.com/blogs/mokhan/archive/2008/10/28/collecting-errors.aspx

--- In domaindrivendesign@yahoogroups.com, "Justin Daubenmire"
<jdaubenm@...> wrote:
>
> If the complexity of the rules were steep, would you personally
place the
> business rules in the money object? or in a business rules object
and pass
> that into the money object?
>
> More less just looking for personal opinions on how steep/complex
business
> rules are handled - understanding that everyone would handle it
differently
> but...
>
> Thanks!
>
> Regards,
> Justin
> ----- Original Message -----
> From: "jasonmeckley" <jasonmeckley@...>
> To: <domaindrivendesign@yahoogroups.com>
> Sent: Monday, November 03, 2008 9:40 PM
> Subject: [domaindrivendesign] Re: difference between value objects
and dto
>
>
> > ultimately it depends on the complexity of the rules. then
> > encapsulating the rules within the Money object itself is perfectly
> > valid.  You could also create a BusinessRules object which is passed
> > to the Money object in the ctor/setter property to validate the
values.
> >
> > --- In domaindrivendesign@yahoogroups.com, "Justin Daubenmire"
> > <jdaubenm@> wrote:
> >>
> >> Greg/All,
> >>
> >> Is it ok then to include business rules directly within value
> > objects? For
> >> example,
> >>
> >> if (money < 0)
> >> {
> >> // don't allow it
> >> }
> >>
> >> or...
> >>
> >> are business rules to be in their own classes outside of value
objects?
> >>
> >> How do most handle the business rules?
> >>
> >> Thanks!
> >>
> >> Regards,
> >> Justin
> >> ----- Original Message -----
> >> From: "Greg Young" <gregoryyoung1@>
> >> To: <domaindrivendesign@yahoogroups.com>
> >> Sent: Monday, November 03, 2008 4:27 PM
> >> Subject: Re: [domaindrivendesign] difference between value objects
> > and dto
> >>
> >>
> >> > immutability is a property they both tend to share but they
have very
> >> > different intents.
> >> >
> >> > Value objects are used to abstract a concept
> >> > DTOs are used to transfer data between layers or tiers
> >> >
> >> > Example: I would use a money object to abstract and represent the
> >> > concept of *money* in my system. One benefit of doing this is
that I
> >> > can insure validty of the data inside (imagine that my concept of
> >> > "Money" does not allow for a negative value or for fractional
pennies
> >> > my Money value object can insure these invariants).
> >> >
> >> > DTOs on the other hand are generally used as thin object to
pass data
> >> > between layers or tiers.
> >> >
> >> > Cheers,
> >> >
> >> > Greg
> >> >
> >> > On Mon, Nov 3, 2008 at 12:31 PM, Justin Daubenmire <jdaubenm@>
> >> > wrote:
> >> >> All,
> >> >>
> >> >> I recently came across a project that was using ddd and I seen
value
> >> >> objects
> >> >> and data transfer objects (dtos) in the project. My question is
> > this,
> >> >> what
> >> >> is the difference between value objects and dtos? Aren't they
> > really the
> >> >> same thing? value objects are non-mutable and so are dto objects.
> >> >>
> >> >> Thanks for any clarification!
> >> >>
> >> >> Justin
> >> >>
> >> >>
> >> >
> >> >
> >> >
> >> > --
> >> > It is the mark of an educated mind to be able to entertain a
thought
> >> > without accepting it.
> >> >
> >> > ------------------------------------
> >> >
> >> > Yahoo! Groups Links
> >> >
> >> >
> >> >
> >>
> >
> >
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> >
> >
>

#8686 From: "Greg Young" <gregoryyoung1@...>
Date: Tue Nov 4, 2008 5:22 pm
Subject: Re: Re: difference between value objects and dto
gumboismadeo...
Send Email Send Email
 
I think you can pretty easily distinguish between these two scenarios
by looking at what the rule applies to.

1) If the rule applies to all instances of money then it belongs on
the money object.
2) If the rule applies only to an instance of money within the context
of some other operation you should probably put it within that
context.
3) The possible exception to #2 is when you see the same logic
appearing in many contexts in which case you would want to refactor
the logic into the money object to reduce duplication. A great example
of this might be IsNegative

Cheers,

Greg


On Tue, Nov 4, 2008 at 4:50 AM, Justin Daubenmire <jdaubenm@...> wrote:
> If the complexity of the rules were steep, would you personally place the
> business rules in the money object? or in a business rules object and pass
> that into the money object?
>
> More less just looking for personal opinions on how steep/complex business
> rules are handled - understanding that everyone would handle it differently
> but...
>
> Thanks!
>
> Regards,
> Justin
> ----- Original Message -----
> From: "jasonmeckley" <jasonmeckley@...>
> To: <domaindrivendesign@yahoogroups.com>
> Sent: Monday, November 03, 2008 9:40 PM
> Subject: [domaindrivendesign] Re: difference between value objects and dto
>
>> ultimately it depends on the complexity of the rules. then
>> encapsulating the rules within the Money object itself is perfectly
>> valid. You could also create a BusinessRules object which is passed
>> to the Money object in the ctor/setter property to validate the values.
>>
>> --- In domaindrivendesign@yahoogroups.com, "Justin Daubenmire"
>> <jdaubenm@...> wrote:
>>>
>>> Greg/All,
>>>
>>> Is it ok then to include business rules directly within value
>> objects? For
>>> example,
>>>
>>> if (money < 0)
>>> {
>>> // don't allow it
>>> }
>>>
>>> or...
>>>
>>> are business rules to be in their own classes outside of value objects?
>>>
>>> How do most handle the business rules?
>>>
>>> Thanks!
>>>
>>> Regards,
>>> Justin
>>> ----- Original Message -----
>>> From: "Greg Young" <gregoryyoung1@...>
>>> To: <domaindrivendesign@yahoogroups.com>
>>> Sent: Monday, November 03, 2008 4:27 PM
>>> Subject: Re: [domaindrivendesign] difference between value objects
>> and dto
>>>
>>>
>>> > immutability is a property they both tend to share but they have very
>>> > different intents.
>>> >
>>> > Value objects are used to abstract a concept
>>> > DTOs are used to transfer data between layers or tiers
>>> >
>>> > Example: I would use a money object to abstract and represent the
>>> > concept of *money* in my system. One benefit of doing this is that I
>>> > can insure validty of the data inside (imagine that my concept of
>>> > "Money" does not allow for a negative value or for fractional pennies
>>> > my Money value object can insure these invariants).
>>> >
>>> > DTOs on the other hand are generally used as thin object to pass data
>>> > between layers or tiers.
>>> >
>>> > Cheers,
>>> >
>>> > Greg
>>> >
>>> > On Mon, Nov 3, 2008 at 12:31 PM, Justin Daubenmire <jdaubenm@...>
>>> > wrote:
>>> >> All,
>>> >>
>>> >> I recently came across a project that was using ddd and I seen value
>>> >> objects
>>> >> and data transfer objects (dtos) in the project. My question is
>> this,
>>> >> what
>>> >> is the difference between value objects and dtos? Aren't they
>> really the
>>> >> same thing? value objects are non-mutable and so are dto objects.
>>> >>
>>> >> Thanks for any clarification!
>>> >>
>>> >> Justin
>>> >>
>>> >>
>>> >
>>> >
>>> >
>>> > --
>>> > It is the mark of an educated mind to be able to entertain a thought
>>> > without accepting it.
>>> >
>>> > ------------------------------------
>>> >
>>> > Yahoo! Groups Links
>>> >
>>> >
>>> >
>>>
>>
>>
>>
>> ------------------------------------
>>
>> Yahoo! Groups Links
>>
>>
>>
>
>



--
It is the mark of an educated mind to be able to entertain a thought
without accepting it.

#8687 From: Justin Daubenmire <jdaubenm@...>
Date: Tue Nov 4, 2008 6:13 pm
Subject: sample ddd project
JDaubenm
Send Email Send Email
 
All,

Does anyone know of a small sample project that I can study that applies ddd? I
understand that ddd is primarily for large scale applications, and really
shouldn't be used on small projects, but I have finished reading eric's book and
having a small sample project to look over that applies the majority of his
concepts would be extremely helpful to me. It would give me a small sample
project to study on how to apply ddd. Does anyone have such a project or know of
a link to one? I primarily program in c#.net but have worked in java too so
either would be fine.

Thanks if anyone can help!

Regards,
Justin

#8688 From: "Donnchadh Ó Donnabháin" <donnchadh@...>
Date: Tue Nov 4, 2008 6:35 pm
Subject: Re: sample ddd project
dodonnabhain
Send Email Send Email
 
Hi Justin,

There is a DDD sample application written in java available at:
http://dddsample.sourceforge.net/

While DDD is very helpful in tackling large scale applications I
certainly wouldn't say that it shouldn't be used on small projects.

   Donnchadh


2008/11/4 Justin Daubenmire <jdaubenm@...>:
> All,
>
> Does anyone know of a small sample project that I can study that applies
> ddd? I understand that ddd is primarily for large scale applications, and
> really shouldn't be used on small projects, but I have finished reading
> eric's book and having a small sample project to look over that applies the
> majority of his concepts would be extremely helpful to me. It would give me
> a small sample project to study on how to apply ddd. Does anyone have such a
> project or know of a link to one? I primarily program in c#.net but have
> worked in java too so either would be fine.
>
> Thanks if anyone can help!
>
> Regards,
> Justin

#8689 From: Justin Daubenmire <jdaubenm@...>
Date: Tue Nov 4, 2008 7:04 pm
Subject: Re: sample ddd project
JDaubenm
Send Email Send Email
 
Hi Donnchadh,

Thanks for the link! I cannot seem to download the file off source forge so I'll
have to try again a bit later... I keep getting a 404.

btw yes, I agree, I would be comfortable using ddd on smaller projects but I
figured I'd toss that out there so folks would not get the impression that I may
be misunderstanding ddd's intent of helping manage larger applications.

Regards,
Justin




--- On Tue, 11/4/08, Donnchadh Ó Donnabháin <donnchadh@...> wrote:

> From: Donnchadh Ó Donnabháin <donnchadh@...>
> Subject: Re: [domaindrivendesign] sample ddd project
> To: domaindrivendesign@yahoogroups.com
> Date: Tuesday, November 4, 2008, 1:35 PM
> Hi Justin,
>
> There is a DDD sample application written in java available
> at:
> http://dddsample.sourceforge.net/
>
> While DDD is very helpful in tackling large scale
> applications I
> certainly wouldn't say that it shouldn't be used on
> small projects.
>
>   Donnchadh
>
>
> 2008/11/4 Justin Daubenmire <jdaubenm@...>:
> > All,
> >
> > Does anyone know of a small sample project that I can
> study that applies
> > ddd? I understand that ddd is primarily for large
> scale applications, and
> > really shouldn't be used on small projects, but I
> have finished reading
> > eric's book and having a small sample project to
> look over that applies the
> > majority of his concepts would be extremely helpful to
> me. It would give me
> > a small sample project to study on how to apply ddd.
> Does anyone have such a
> > project or know of a link to one? I primarily program
> in c#.net but have
> > worked in java too so either would be fine.
> >
> > Thanks if anyone can help!
> >
> > Regards,
> > Justin
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>

#8690 From: "Justin Daubenmire" <jdaubenm@...>
Date: Tue Nov 4, 2008 8:50 pm
Subject: Re: sample ddd project
JDaubenm
Send Email Send Email
 
All,

Can someone please email me dddsample-1.0-src.zip as source forge will not
let me download it.

When I receive it from someone I'll reply to the list so I don't get bombed
by hundreds of attachments *grin*.

Thanks!

Regards,
Justin
----- Original Message -----
From: "Donnchadh Ó Donnabháin" <donnchadh@...>
To: <domaindrivendesign@yahoogroups.com>
Sent: Tuesday, November 04, 2008 1:35 PM
Subject: Re: [domaindrivendesign] sample ddd project


>  Hi Justin,
>
> There is a DDD sample application written in java available at:
> http://dddsample.sourceforge.net/
>
> While DDD is very helpful in tackling large scale applications I
> certainly wouldn't say that it shouldn't be used on small projects.
>
>  Donnchadh
>
>
> 2008/11/4 Justin Daubenmire <jdaubenm@...>:
>> All,
>>
>> Does anyone know of a small sample project that I can study that applies
>> ddd? I understand that ddd is primarily for large scale applications, and
>> really shouldn't be used on small projects, but I have finished reading
>> eric's book and having a small sample project to look over that applies
>> the
>> majority of his concepts would be extremely helpful to me. It would give
>> me
>> a small sample project to study on how to apply ddd. Does anyone have
>> such a
>> project or know of a link to one? I primarily program in c#.net but have
>> worked in java too so either would be fine.
>>
>> Thanks if anyone can help!
>>
>> Regards,
>> Justin
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>

#8691 From: "Patrik Nordwall" <patrik_nordwall@...>
Date: Tue Nov 4, 2008 9:00 pm
Subject: Re: sample ddd project
patrik_nordwall
Send Email Send Email
 
Try to download it from this location:
http://sourceforge.net/project/showfiles.php?
group_id=210606

--- In domaindrivendesign@yahoogroups.com, "Justin Daubenmire" <jdaubenm@...>
wrote:
>
> All,
>
> Can someone please email me dddsample-1.0-src.zip as source forge will not
> let me download it.
>

#8692 From: "Adam Tybor" <adam.tybor@...>
Date: Tue Nov 4, 2008 8:57 pm
Subject: Re: sample ddd project
atybor
Send Email Send Email
 
Try this link
http://sourceforge.net/project/showfiles.php?group_id=210606

or just checkout from the sourceforge repo

svn co https://dddsample.svn.sourceforge.net/svnroot/dddsample dddsample

--- In domaindrivendesign@yahoogroups.com, "Justin Daubenmire"
<jdaubenm@...> wrote:
>
> All,
>
> Can someone please email me dddsample-1.0-src.zip as source forge
will not
> let me download it.
>
> When I receive it from someone I'll reply to the list so I don't get
bombed
> by hundreds of attachments *grin*.
>
> Thanks!
>
> Regards,
> Justin
> ----- Original Message -----
> From: "Donnchadh Ã" Donnabháin" <donnchadh@...>
> To: <domaindrivendesign@yahoogroups.com>
> Sent: Tuesday, November 04, 2008 1:35 PM
> Subject: Re: [domaindrivendesign] sample ddd project
>
>
> >  Hi Justin,
> >
> > There is a DDD sample application written in java available at:
> > http://dddsample.sourceforge.net/
> >
> > While DDD is very helpful in tackling large scale applications I
> > certainly wouldn't say that it shouldn't be used on small projects.
> >
> >  Donnchadh
> >
> >
> > 2008/11/4 Justin Daubenmire <jdaubenm@...>:
> >> All,
> >>
> >> Does anyone know of a small sample project that I can study that
applies
> >> ddd? I understand that ddd is primarily for large scale
applications, and
> >> really shouldn't be used on small projects, but I have finished
reading
> >> eric's book and having a small sample project to look over that
applies
> >> the
> >> majority of his concepts would be extremely helpful to me. It
would give
> >> me
> >> a small sample project to study on how to apply ddd. Does anyone
have
> >> such a
> >> project or know of a link to one? I primarily program in c#.net
but have
> >> worked in java too so either would be fine.
> >>
> >> Thanks if anyone can help!
> >>
> >> Regards,
> >> Justin
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> >
> >
>

#8693 From: "Justin Daubenmire" <jdaubenm@...>
Date: Tue Nov 4, 2008 9:07 pm
Subject: Re: Re: sample ddd project
JDaubenm
Send Email Send Email
 
Thanks guys I got it! *thumbs up*.

Regards,
Justin
----- Original Message -----
From: "Adam Tybor" <adam.tybor@...>
To: <domaindrivendesign@yahoogroups.com>
Sent: Tuesday, November 04, 2008 3:57 PM
Subject: [domaindrivendesign] Re: sample ddd project


Try this link
http://sourceforge.net/project/showfiles.php?group_id=210606

or just checkout from the sourceforge repo

svn co https://dddsample.svn.sourceforge.net/svnroot/dddsample dddsample

--- In domaindrivendesign@yahoogroups.com, "Justin Daubenmire"
<jdaubenm@...> wrote:
>
> All,
>
> Can someone please email me dddsample-1.0-src.zip as source forge
will not
> let me download it.
>
> When I receive it from someone I'll reply to the list so I don't get
bombed
> by hundreds of attachments *grin*.
>
> Thanks!
>
> Regards,
> Justin
> ----- Original Message -----
> From: "Donnchadh Ã" Donnabháin" <donnchadh@...>
> To: <domaindrivendesign@yahoogroups.com>
> Sent: Tuesday, November 04, 2008 1:35 PM
> Subject: Re: [domaindrivendesign] sample ddd project
>
>
> >  Hi Justin,
> >
> > There is a DDD sample application written in java available at:
> > http://dddsample.sourceforge.net/
> >
> > While DDD is very helpful in tackling large scale applications I
> > certainly wouldn't say that it shouldn't be used on small projects.
> >
> >  Donnchadh
> >
> >
> > 2008/11/4 Justin Daubenmire <jdaubenm@...>:
> >> All,
> >>
> >> Does anyone know of a small sample project that I can study that
applies
> >> ddd? I understand that ddd is primarily for large scale
applications, and
> >> really shouldn't be used on small projects, but I have finished
reading
> >> eric's book and having a small sample project to look over that
applies
> >> the
> >> majority of his concepts would be extremely helpful to me. It
would give
> >> me
> >> a small sample project to study on how to apply ddd. Does anyone
have
> >> such a
> >> project or know of a link to one? I primarily program in c#.net
but have
> >> worked in java too so either would be fine.
> >>
> >> Thanks if anyone can help!
> >>
> >> Regards,
> >> Justin
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> >
> >
>



------------------------------------

Yahoo! Groups Links

#8694 From: "Justin Daubenmire" <jdaubenm@...>
Date: Tue Nov 4, 2008 10:55 pm
Subject: c#.net dnn simple explanation
JDaubenm
Send Email Send Email
 
All,

This simple blog post:

http://weblogs.asp.net/bsimser/archive/2007/01/21/domain-driven-design-for-c-3-0\
.aspx



offers a simple explanation on how to apply dnn using c#.net.

It's like 10 lines of source code - very quick read.

I understand that context has allot to do with whether something is an
intity or value object, however, I am looking for opinions on the blog
post... do you think it is fairly accurate?


Thanks for any feedback!

Regards,
Justin

#8695 From: "Greg Young" <gregoryyoung1@...>
Date: Tue Nov 4, 2008 11:30 pm
Subject: Re: c#.net dnn simple explanation
gumboismadeo...
Send Email Send Email
 
My first question would be wtf is the meaning of anything listed here.

     1 namespace Car
     2 {
     3     class Wheel { ... }
     4     class Position { ... }
     5     class CarRepository { ... }
     6     class FuelTransfer { ... }
     7 }

     9 domain Transportation
    10 {
    11     aggregate Car
    12     {
    13         entity Wheel { ... }
    14         valueobject Position { ... }
    15         repository CarRepository { ... }
    16         service FuelTransfer { ... }
    17     }
    18 }

A few questions ...


Why am I defining a FuelTransferService under the context of a Car Aggregate?

What does defining a ValueObject of Position do? Does it add
additional restrictions on how that object can interact with other
objects like it must be immutable?

Why am I defining a Repository inside the context of a Car? Couldn't
it be determined to exist based on the existence of the Car aggregate?

What am I gaining in all of this? All I see is that words are being
used with no meaning. Unless there is meaning assigned to the words I
see this as fairly useless.

Cheers,

Greg

On Tue, Nov 4, 2008 at 2:55 PM, Justin Daubenmire <jdaubenm@...> wrote:
> All,
>
> This simple blog post:
>
>
http://weblogs.asp.net/bsimser/archive/2007/01/21/domain-driven-design-for-c-3-0\
.aspx
>
> offers a simple explanation on how to apply dnn using c#.net.
>
> It's like 10 lines of source code - very quick read.
>
> I understand that context has allot to do with whether something is an
> intity or value object, however, I am looking for opinions on the blog
> post... do you think it is fairly accurate?
>
> Thanks for any feedback!
>
> Regards,
> Justin
>
>



--
It is the mark of an educated mind to be able to entertain a thought
without accepting it.

#8696 From: "Scott Millett" <scott@...>
Date: Wed Nov 5, 2008 3:40 pm
Subject: Aggregate Roots
elbandit33
Send Email Send Email
 

Hello,

I have an Order Aggregate Root and a Stock Aggregate Root. When I want to retrieve an Order from the OrderRepository I want the orderlines and Stock information fully hydrated. 

(a) Is it ok for the OrderRepository to hydrate the stock information

Public Class OrderService

       
Public Function GetOrder(ByVal ID As Long) As Order
                
Return _OrderRepository.GetOrder(ID)
       
End Function

End Class

(b) Or should the order service delegete this to the stockRepository?

Public Class OrderService

       Public Function GetOrder(ByVal ID As Long) As Order
       
             
Dim anOrder As Order = _OrderRepository.GetOrder(ID)
 
             
For Each OL As OrderLine In anOrder.OrderLines
                         OL.Product.StockItem = _StockRepository.GetStockItem(OL.Product.ID)
            
Next

             Return anOrder
      
End Function

End Class

Cheers
Scott


#8697 From: "jasonmeckley" <jasonmeckley@...>
Date: Wed Nov 5, 2008 4:36 pm
Subject: Re: Aggregate Roots
jasonmeckley
Send Email Send Email
 
this depends on the context of how stock and order relate.
Stock may be it's own aggregate root, but in this context it appears
stock is a child of the Order root.

I would go with option A. If, in fact, option B is the more correct
approach I would pass either or entire order, or an enumeration of
associated products to the repository, and have the repository manage
the details (encapsulation). So either
foreach(Product product in order.AssociatedProducts)
{
    Stock stock = repository.GetStockFor(product);
}
or
Stock[] stocks = repository.GetStockForProductsAssociatedWith(order);

--- In domaindrivendesign@yahoogroups.com, "Scott Millett" <scott@...>
wrote:
>
>
> Hello,
>
> I have an Order Aggregate Root and a Stock Aggregate Root. When I want
> to retrieve an Order from the OrderRepository I want the orderlines and
> Stock information fully hydrated.
>
> (a) Is it ok for the OrderRepository to hydrate the stock information
>
> Public Class OrderService
>
>          Public Function GetOrder(ByVal ID As Long) As Order
>                   Return _OrderRepository.GetOrder(ID)
>          End Function
>
> End Class
>
> (b) Or should the order service delegete this to the stockRepository?
>
> Public Class OrderService
>
>         Public Function GetOrder(ByVal ID As Long) As Order
>
>                Dim anOrder As Order = _OrderRepository.GetOrder(ID)
>
>                For Each OL As OrderLine In anOrder.OrderLines
>                           OL.Product.StockItem =
> _StockRepository.GetStockItem(OL.Product.ID)
>               Next
>
>               Return anOrder
>         End Function
>
> End Class
>
> Cheers
> Scott
>

#8698 From: "Scott Millett" <scott@...>
Date: Wed Nov 5, 2008 5:14 pm
Subject: Re: Aggregate Roots
elbandit33
Send Email Send Email
 

Yes Stock is a child of Order.OrderLine, but it has its own Respository.  The reason its has its own respository and thus the reason for my original question is because I started to code my OrderService ProcessOrder Method like so:

Public Class OrderService

       Public Sub ProcessOrder(ByVal Order as Order)

                   ' Checks to ensure we can ship and changes state to shipped, also puts
                   ' any lines that we can't fulfill onto back order

                   Order.Process()

                   ' Persist the Order (and Backorder if there is one)
                   _OrderRepository.Save(Order)

                   ' Adjust the Stock Levels for all the stock associated with this order
                 
For Each ol As OrderLine In Order.OrderLines
                           
  _StockRepository.AdjustStockOut(ol.Product.StockItem, ol.Product.StockItem.StockAllocatedInTransaction)
                  Next

                  ' Commit all changes
                  UnitOfWork.Commit()
        
End Sub

End
Class

Does this make sense? I have been struggling on this for a while, I would be intrested to hear your opinions.

Cheers
Scott


--- In domaindrivendesign@yahoogroups.com, "jasonmeckley" <jasonmeckley@...> wrote:
>
> this depends on the context of how stock and order relate.
> Stock may be it's own aggregate root, but in this context it appears
> stock is a child of the Order root.
>
> I would go with option A. If, in fact, option B is the more correct
> approach I would pass either or entire order, or an enumeration of
> associated products to the repository, and have the repository manage
> the details (encapsulation). So either
> foreach(Product product in order.AssociatedProducts)
> {
> Stock stock = repository.GetStockFor(product);
> }
> or
> Stock[] stocks = repository.GetStockForProductsAssociatedWith(order);
>
> --- In domaindrivendesign@yahoogroups.com, "Scott Millett" scott@
> wrote:
> >
> >
> > Hello,
> >
> > I have an Order Aggregate Root and a Stock Aggregate Root. When I want
> > to retrieve an Order from the OrderRepository I want the orderlines and
> > Stock information fully hydrated.
> >
> > (a) Is it ok for the OrderRepository to hydrate the stock information
> >
> > Public Class OrderService
> >
> > Public Function GetOrder(ByVal ID As Long) As Order
> > Return _OrderRepository.GetOrder(ID)
> > End Function
> >
> > End Class
> >
> > (b) Or should the order service delegete this to the stockRepository?
> >
> > Public Class OrderService
> >
> > Public Function GetOrder(ByVal ID As Long) As Order
> >
> > Dim anOrder As Order = _OrderRepository.GetOrder(ID)
> >
> > For Each OL As OrderLine In anOrder.OrderLines
> > OL.Product.StockItem =
> > _StockRepository.GetStockItem(OL.Product.ID)
> > Next
> >
> > Return anOrder
> > End Function
> >
> > End Class
> >
> > Cheers
> > Scott
> >
>


#8699 From: "jasonmeckley" <jasonmeckley@...>
Date: Wed Nov 5, 2008 5:35 pm
Subject: Re: Aggregate Roots
jasonmeckley
Send Email Send Email
 
yes, this looks good. i would make one adjustment though. encapsulate
the StockItem maybe something like

_StockRepository.AdjustStockOutBasedOn(Order);
or
foreach(StockItem item in Order.GetAssociatedItemInStock())
    _StockRepository.AdjustStockOut(item);

there may even be more fluent approach I'm overlooking. the more you
traverse an aggregate the more exposure you have.


--- In domaindrivendesign@yahoogroups.com, "Scott Millett" <scott@...>
wrote:
>
>
> Yes Stock is a child of Order.OrderLine, but it has its own Respository.
> The reason its has its own respository and thus the reason for my
> original question is because I started to code my OrderService
> ProcessOrder Method like so:
>
> Public Class OrderService
>
>         Public Sub ProcessOrder(ByVal Order as Order)
>
>                     ' Checks to ensure we can ship and changes state to
> shipped, also puts
>                     ' any lines that we can't fulfill onto back order
>                     Order.Process()
>
>                     ' Persist the Order (and Backorder if there is one)
>                     _OrderRepository.Save(Order)
>
>                     ' Adjust the Stock Levels for all the stock
> associated with this order
>                    For Each ol As OrderLine In Order.OrderLines
>
> _StockRepository.AdjustStockOut(ol.Product.StockItem,
> ol.Product.StockItem.StockAllocatedInTransaction)
>                    Next
>
>                    ' Commit all changes
>                    UnitOfWork.Commit()
>          End Sub
>
> End Class
>
> Does this make sense? I have been struggling on this for a while, I
> would be intrested to hear your opinions.
>
> Cheers
> Scott
>
> --- In domaindrivendesign@yahoogroups.com, "jasonmeckley"
> <jasonmeckley@> wrote:
> >
> > this depends on the context of how stock and order relate.
> > Stock may be it's own aggregate root, but in this context it appears
> > stock is a child of the Order root.
> >
> > I would go with option A. If, in fact, option B is the more correct
> > approach I would pass either or entire order, or an enumeration of
> > associated products to the repository, and have the repository manage
> > the details (encapsulation). So either
> > foreach(Product product in order.AssociatedProducts)
> > {
> > Stock stock = repository.GetStockFor(product);
> > }
> > or
> > Stock[] stocks = repository.GetStockForProductsAssociatedWith(order);
> >
> > --- In domaindrivendesign@yahoogroups.com, "Scott Millett" scott@
> > wrote:
> > >
> > >
> > > Hello,
> > >
> > > I have an Order Aggregate Root and a Stock Aggregate Root. When I
> want
> > > to retrieve an Order from the OrderRepository I want the orderlines
> and
> > > Stock information fully hydrated.
> > >
> > > (a) Is it ok for the OrderRepository to hydrate the stock
> information
> > >
> > > Public Class OrderService
> > >
> > > Public Function GetOrder(ByVal ID As Long) As Order
> > > Return _OrderRepository.GetOrder(ID)
> > > End Function
> > >
> > > End Class
> > >
> > > (b) Or should the order service delegete this to the
> stockRepository?
> > >
> > > Public Class OrderService
> > >
> > > Public Function GetOrder(ByVal ID As Long) As Order
> > >
> > > Dim anOrder As Order = _OrderRepository.GetOrder(ID)
> > >
> > > For Each OL As OrderLine In anOrder.OrderLines
> > > OL.Product.StockItem =
> > > _StockRepository.GetStockItem(OL.Product.ID)
> > > Next
> > >
> > > Return anOrder
> > > End Function
> > >
> > > End Class
> > >
> > > Cheers
> > > Scott
> > >
> >
>

#8700 From: "fregasbaratis" <fregas@...>
Date: Wed Nov 5, 2008 4:13 pm
Subject: 2 Questions
fregasbaratis
Send Email Send Email
 
I'm using DDD with NHibernate.  I was wondering, should domain objects
ever call into repository object methods?  For example, to go grab
some related data that for some reason NHibernate can't get for me
very easily?

#8701 From: "fregasbaratis" <fregas@...>
Date: Wed Nov 5, 2008 4:25 pm
Subject: Repositories, Aggregate Roots in a web application
fregasbaratis
Send Email Send Email
 
One thing I have struggled with in DDD is this concept of "aggregate"
roots.  The .NET CSLA framework has a similar concept and I struggled
with it back when I used that.

Let me give you an example.  In a desktop application, you might get a
customer object, which is the aggregate root.  Then you might click on
something in a grid to view the customer's orders, then click on an
order to see one of them in more detail and then see the order lines.

In this case, the customer is an obvious aggregate root.  I'll ask my
CustomerRepository to get me a customer object, and then navigate to
Orders and OrderLines thru object references:
myCustomer.Orders[0].OrderLines

and simply pass the references from one UI control or form object to
another.

Simple DDD, no big deal.

However, in the web application world, things are quite different.
When I click on an order, I will likely go to a new page to view that
order.  I'll pass the OrderID on the URL and on the new page, I'll
have to get the order fresh.  I probably wont want to get the
customer, load up all the orders and find the one I want by index.  So
in this case, i'll need a CustomerRepository and an OrderRepository
and I have two aggregate roots, one for the first page, one for the
second.  I find this happening all over the place, where in my web
application the "aggregate root" changes depending on context so I end
up needing to create a bunch of Repositories since you're supposed to
create a Repo for each aggregate root.  Also, in some scenarios I may
want to get the Customer first and then navigate to the orders, in
other scenarios i may want to get an Order and then navigate to to its
Customer object.  Bi-directional relationships are pretty common.

This also doesn't take into all the cases where I just need a
collection as the root, or part of a collection with paging, and
things like that.

I've always struggled with the concept of a "root" object because I
feel like objects should have the option of being bi-directional, that
roots can start anywhere depending on context and O/R Mappers such as
NHibernate make this a lot easier nowadays then when Eric Evans wrote
his famous book.

How does all this synch with DDD and the concept of aggregate roots?
I know this is a lot to ask but any guidance would be appreciated.

Thanks,
Craig

#8702 From: "Richard Dingwall" <rdingwall@...>
Date: Tue Nov 4, 2008 8:09 pm
Subject: Re: sample ddd project
rdingwall@...
Send Email Send Email
 
On Wed, Nov 5, 2008 at 7:13 AM, Justin Daubenmire <jdaubenm@...> wrote:
> Does anyone know of a small sample project that I can study that applies
> ddd? I understand that ddd is primarily for large scale applications, and
> really shouldn't be used on small projects, but I have finished reading
> eric's book and having a small sample project to look over that applies the
> majority of his concepts would be extremely helpful to me. It would give me
> a small sample project to study on how to apply ddd. Does anyone have such a
> project or know of a link to one? I primarily program in c#.net but have
> worked in java too so either would be fine.

If web stuff is your thing, I compiled a (very) short list of DDD/TDD
ASP.NET MVC web applications last weekend:

http://richarddingwall.name/2008/11/02/best-practice-dddtdd-aspnet-mvc-example-a\
pplications/

Rich

Messages 8673 - 8702 of 24070   Oldest  |  < Older  |  Newer >  |  Newest
Add to My Yahoo!      XML What's This?

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help