Patrik Nordwall | 1 Nov 14:22
Picon
Favicon

Sculptor port of DDD sample

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 

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

Jeremy Wiebe | 2 Nov 04:46
Picon
Gravatar

Managing relationships to objects not part of an aggregate root

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 <at> gmail.com
__._,_.___

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

__,_._,___
Justin Daubenmire | 3 Nov 21:31
Picon
Favicon

difference between value objects and dto

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

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

Greg Young | 3 Nov 22:27
Picon
Gravatar

Re: 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 <at> yahoo.com> 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.

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

Greg Young | 3 Nov 22:32
Picon
Gravatar

Re: Managing relationships to objects not part of an aggregate root

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 <at> gmail.com> 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 <at> gmail.com
>
> 

--

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

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

jasonmeckley | 3 Nov 22:58
Picon
Gravatar

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

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

Justin Daubenmire | 4 Nov 00:06
Picon
Favicon

Re: Re: difference between value objects and dto

Thanks guys for the clarification... it now has "clicked"!

Regards,
Justin
----- Original Message ----- 
From: "jasonmeckley" <jasonmeckley <at> gmail.com>
To: <domaindrivendesign <at> 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 <at> 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
> 
> 
> 

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

Justin Daubenmire | 4 Nov 00:26
Picon
Favicon

question on layers in a project

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 

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

Justin Daubenmire | 4 Nov 01:52
Picon
Favicon

Re: difference between value objects and dto

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 <at> gmail.com>
To: <domaindrivendesign <at> 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 <at> yahoo.com> 
> 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
>
>
>

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

Yim Carfield | 4 Nov 02:18
Picon

Re: Managing relationships to objects not part of an aggregate root

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 <at> gmail.com> 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 <at> gmail.com

__._,_.___

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