<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Don&#8217;t Create Aggregate Roots</title>
	<atom:link href="http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/</link>
	<description>Enterprise Development Expert &#38; SOA Specialist</description>
	<lastBuildDate>Sun, 14 Mar 2010 06:27:00 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Strengthening your domain: Aggregate Construction - Jimmy Bogard - Los Techies : Blogs about software and anything tech!</title>
		<link>http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/comment-page-2/#comment-37047</link>
		<dc:creator>Strengthening your domain: Aggregate Construction - Jimmy Bogard - Los Techies : Blogs about software and anything tech!</dc:creator>
		<pubDate>Wed, 24 Feb 2010 04:12:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.udidahan.com/?p=1042#comment-37047</guid>
		<description>[...] Through existing aggregate roots [...]</description>
		<content:encoded><![CDATA[<p>[...] Through existing aggregate roots [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon</title>
		<link>http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/comment-page-2/#comment-37033</link>
		<dc:creator>Jon</dc:creator>
		<pubDate>Thu, 18 Feb 2010 19:48:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.udidahan.com/?p=1042#comment-37033</guid>
		<description>Hi Udi,

I really like the idea of persistence by reachability. However, I&#039;m trying to implement this using NHibernate and I&#039;ve run into a problem with many to many relationships. How do you avoid loading up the entire collection when adding to it?

Thanks,
Jon</description>
		<content:encoded><![CDATA[<p>Hi Udi,</p>
<p>I really like the idea of persistence by reachability. However, I&#8217;m trying to implement this using NHibernate and I&#8217;ve run into a problem with many to many relationships. How do you avoid loading up the entire collection when adding to it?</p>
<p>Thanks,<br />
Jon</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard Dingwall &#187; Life inside an Aggregate Root, part 2</title>
		<link>http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/comment-page-2/#comment-36794</link>
		<dc:creator>Richard Dingwall &#187; Life inside an Aggregate Root, part 2</dc:creator>
		<pubDate>Tue, 13 Oct 2009 18:31:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.udidahan.com/?p=1042#comment-36794</guid>
		<description>[...] The new keyword is a bit of a smell here &#8212; as Udi Dahan recently stated in a blog post, customers don&#8217;t just appear out of thin air. Let&#8217;s flip it [...]</description>
		<content:encoded><![CDATA[<p>[...] The new keyword is a bit of a smell here &#8212; as Udi Dahan recently stated in a blog post, customers don&#8217;t just appear out of thin air. Let&#8217;s flip it [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: udidahan</title>
		<link>http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/comment-page-2/#comment-36769</link>
		<dc:creator>udidahan</dc:creator>
		<pubDate>Thu, 08 Oct 2009 15:15:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.udidahan.com/?p=1042#comment-36769</guid>
		<description>Well Mike,

Then we can agree to disagree :)</description>
		<content:encoded><![CDATA[<p>Well Mike,</p>
<p>Then we can agree to disagree <img src='http://www.udidahan.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Scott</title>
		<link>http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/comment-page-2/#comment-36768</link>
		<dc:creator>Mike Scott</dc:creator>
		<pubDate>Thu, 08 Oct 2009 11:35:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.udidahan.com/?p=1042#comment-36768</guid>
		<description>Hi Udi,

&quot;Would a unit test that mocks out the persistence layer give us much more confidence in the correctness of the code?&quot;

Yes, I believe it would. I think the service code should be unit-tested as well, even though it&#039;s simple. Any breaking changes will be detected in seconds, rather than waiting for them to fail in the integration tests and be more difficult to track down later.

If you take your argument to its logical conclusion, we could do away with unit tests altogether and rely solely on automated integration testing, could we not?

There&#039;s also the issue of using unit testing - or better to say specifying - first in order to create more expressive interfaces.</description>
		<content:encoded><![CDATA[<p>Hi Udi,</p>
<p>&#8220;Would a unit test that mocks out the persistence layer give us much more confidence in the correctness of the code?&#8221;</p>
<p>Yes, I believe it would. I think the service code should be unit-tested as well, even though it&#8217;s simple. Any breaking changes will be detected in seconds, rather than waiting for them to fail in the integration tests and be more difficult to track down later.</p>
<p>If you take your argument to its logical conclusion, we could do away with unit tests altogether and rely solely on automated integration testing, could we not?</p>
<p>There&#8217;s also the issue of using unit testing &#8211; or better to say specifying &#8211; first in order to create more expressive interfaces.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: udidahan</title>
		<link>http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/comment-page-2/#comment-36760</link>
		<dc:creator>udidahan</dc:creator>
		<pubDate>Sun, 04 Oct 2009 08:51:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.udidahan.com/?p=1042#comment-36760</guid>
		<description>Mike,

You bring up the point exactly:

&quot;It has to work with the persistence layer as well as calling into the domain&quot;

Would a unit test that mocks out the persistence layer give us much more confidence in the correctness of the code? So much so that we didn&#039;t need the integration test? And if we do go and put an integration test in place, what incremental value does the unit test provide? Does it, in essence, assert that the code is implemented the way it&#039;s implemented?

Hope that makes sense.</description>
		<content:encoded><![CDATA[<p>Mike,</p>
<p>You bring up the point exactly:</p>
<p>&#8220;It has to work with the persistence layer as well as calling into the domain&#8221;</p>
<p>Would a unit test that mocks out the persistence layer give us much more confidence in the correctness of the code? So much so that we didn&#8217;t need the integration test? And if we do go and put an integration test in place, what incremental value does the unit test provide? Does it, in essence, assert that the code is implemented the way it&#8217;s implemented?</p>
<p>Hope that makes sense.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: udidahan</title>
		<link>http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/comment-page-2/#comment-36759</link>
		<dc:creator>udidahan</dc:creator>
		<pubDate>Sun, 04 Oct 2009 08:48:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.udidahan.com/?p=1042#comment-36759</guid>
		<description>Jørn,

Check out this link as well:

http://www.udidahan.com/2008/02/15/from-crud-to-domain-driven-fluency/</description>
		<content:encoded><![CDATA[<p>Jørn,</p>
<p>Check out this link as well:</p>
<p><a href="http://www.udidahan.com/2008/02/15/from-crud-to-domain-driven-fluency/" rel="nofollow">http://www.udidahan.com/2008/02/15/from-crud-to-domain-driven-fluency/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Scott</title>
		<link>http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/comment-page-2/#comment-36750</link>
		<dc:creator>Mike Scott</dc:creator>
		<pubDate>Tue, 29 Sep 2009 14:44:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.udidahan.com/?p=1042#comment-36750</guid>
		<description>Udi

I understand that the service layer only makes a single call into the domain layer, but I&#039;m still not convinced that it&#039;s not doing enough orchestrating that it doesn&#039;t need unit testing. It has to work with the persistence layer as well as calling into the domain.

However, I do see your pont that if you have NHibernate code creating a session and a transaction in the session layer, that you could just forego abstracting your persistence, ignore unit testing and rely on integration tests.

Is this what you&#039;re advocating?</description>
		<content:encoded><![CDATA[<p>Udi</p>
<p>I understand that the service layer only makes a single call into the domain layer, but I&#8217;m still not convinced that it&#8217;s not doing enough orchestrating that it doesn&#8217;t need unit testing. It has to work with the persistence layer as well as calling into the domain.</p>
<p>However, I do see your pont that if you have NHibernate code creating a session and a transaction in the session layer, that you could just forego abstracting your persistence, ignore unit testing and rely on integration tests.</p>
<p>Is this what you&#8217;re advocating?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jørn Wildt</title>
		<link>http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/comment-page-2/#comment-36742</link>
		<dc:creator>Jørn Wildt</dc:creator>
		<pubDate>Fri, 25 Sep 2009 18:25:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.udidahan.com/?p=1042#comment-36742</guid>
		<description>Udi, is it this your are talking about: http://www.udidahan.com/2007/10/26/teched-speaking-about-high-performance-persistent-domain-models/ when you say High Performance Domain Models presentation?

The links on that page are not alive anymore :-(

Can it be found elsewhere?</description>
		<content:encoded><![CDATA[<p>Udi, is it this your are talking about: <a href="http://www.udidahan.com/2007/10/26/teched-speaking-about-high-performance-persistent-domain-models/" rel="nofollow">http://www.udidahan.com/2007/10/26/teched-speaking-about-high-performance-persistent-domain-models/</a> when you say High Performance Domain Models presentation?</p>
<p>The links on that page are not alive anymore <img src='http://www.udidahan.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </p>
<p>Can it be found elsewhere?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: udidahan</title>
		<link>http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/comment-page-2/#comment-36741</link>
		<dc:creator>udidahan</dc:creator>
		<pubDate>Thu, 24 Sep 2009 20:26:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.udidahan.com/?p=1042#comment-36741</guid>
		<description>Mike,

The service layer shouldn&#039;t orchestrate - after getting a domain object or two, it calls a single method on one of them, that&#039;s it.

See my High Performance Domain Models presentation.</description>
		<content:encoded><![CDATA[<p>Mike,</p>
<p>The service layer shouldn&#8217;t orchestrate &#8211; after getting a domain object or two, it calls a single method on one of them, that&#8217;s it.</p>
<p>See my High Performance Domain Models presentation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Scott</title>
		<link>http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/comment-page-2/#comment-36740</link>
		<dc:creator>Mike Scott</dc:creator>
		<pubDate>Thu, 24 Sep 2009 15:53:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.udidahan.com/?p=1042#comment-36740</guid>
		<description>Hi Udi

It makes sense to test the domain model, of course, but it also makes sense to test the service layer to make sure it is orchestrating things correctly, no?</description>
		<content:encoded><![CDATA[<p>Hi Udi</p>
<p>It makes sense to test the domain model, of course, but it also makes sense to test the service layer to make sure it is orchestrating things correctly, no?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: udidahan</title>
		<link>http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/comment-page-2/#comment-36737</link>
		<dc:creator>udidahan</dc:creator>
		<pubDate>Mon, 21 Sep 2009 18:21:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.udidahan.com/?p=1042#comment-36737</guid>
		<description>Mike,

The only code that depends on the ORM is the service layer. The domain model doesn&#039;t depend on anything other than itself - and it&#039;s the thing you&#039;ll be unit testing.

Does that make sense?</description>
		<content:encoded><![CDATA[<p>Mike,</p>
<p>The only code that depends on the ORM is the service layer. The domain model doesn&#8217;t depend on anything other than itself &#8211; and it&#8217;s the thing you&#8217;ll be unit testing.</p>
<p>Does that make sense?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Scott</title>
		<link>http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/comment-page-2/#comment-36733</link>
		<dc:creator>Mike Scott</dc:creator>
		<pubDate>Sun, 20 Sep 2009 21:29:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.udidahan.com/?p=1042#comment-36733</guid>
		<description>Sure, understand perfectly. But that leads to the next question ;)

Unit testing! How do you unit test the code that depends on the ORM? Do you abstract it?</description>
		<content:encoded><![CDATA[<p>Sure, understand perfectly. But that leads to the next question <img src='http://www.udidahan.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Unit testing! How do you unit test the code that depends on the ORM? Do you abstract it?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: udidahan</title>
		<link>http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/comment-page-2/#comment-36731</link>
		<dc:creator>udidahan</dc:creator>
		<pubDate>Sun, 20 Sep 2009 05:47:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.udidahan.com/?p=1042#comment-36731</guid>
		<description>Mike,

The repository in this case would need to be nothing more than a regular ORM that eagerly fetched the cart object  (if there was one) along with the user object. You don&#039;t need a custom repository for this.

The same thing goes for &quot;persistence by reachability&quot;, since the user object gets dirty, the ORM knows to persist it and the objects connected to it.

Hope that makes sense.</description>
		<content:encoded><![CDATA[<p>Mike,</p>
<p>The repository in this case would need to be nothing more than a regular ORM that eagerly fetched the cart object  (if there was one) along with the user object. You don&#8217;t need a custom repository for this.</p>
<p>The same thing goes for &#8220;persistence by reachability&#8221;, since the user object gets dirty, the ORM knows to persist it and the objects connected to it.</p>
<p>Hope that makes sense.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Scott</title>
		<link>http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/comment-page-2/#comment-36730</link>
		<dc:creator>Mike Scott</dc:creator>
		<pubDate>Sun, 20 Sep 2009 00:45:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.udidahan.com/?p=1042#comment-36730</guid>
		<description>Hi Udi

So if I&#039;m following you correctly, the user would be the aggregate root and the user repository would built the aggregate, assigning the cart if one existed already or leaving it null if not.

Then, in the user class&#039; domain logic, there would be code to create a new cart if it was null and this would be persisted by reachability?

If so, I can see that the code to deal with the cart is in the repository if one exists, and in the domain object if not. The usual way of handling this would be to have the load/check and creation together in the same piece of code, though your suggestion seems reasonable :-)</description>
		<content:encoded><![CDATA[<p>Hi Udi</p>
<p>So if I&#8217;m following you correctly, the user would be the aggregate root and the user repository would built the aggregate, assigning the cart if one existed already or leaving it null if not.</p>
<p>Then, in the user class&#8217; domain logic, there would be code to create a new cart if it was null and this would be persisted by reachability?</p>
<p>If so, I can see that the code to deal with the cart is in the repository if one exists, and in the domain object if not. The usual way of handling this would be to have the load/check and creation together in the same piece of code, though your suggestion seems reasonable <img src='http://www.udidahan.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: udidahan</title>
		<link>http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/comment-page-2/#comment-36722</link>
		<dc:creator>udidahan</dc:creator>
		<pubDate>Thu, 17 Sep 2009 17:36:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.udidahan.com/?p=1042#comment-36722</guid>
		<description>Mike,

The user object would have a reference to its cart object - check if its null, if so, create a new one, set the reference. The ORM would do the dirty tracking on the user object and know to persist the new cart / the modified old cart.

Does that answer your question?</description>
		<content:encoded><![CDATA[<p>Mike,</p>
<p>The user object would have a reference to its cart object &#8211; check if its null, if so, create a new one, set the reference. The ORM would do the dirty tracking on the user object and know to persist the new cart / the modified old cart.</p>
<p>Does that answer your question?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Scott</title>
		<link>http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/comment-page-1/#comment-36714</link>
		<dc:creator>Mike Scott</dc:creator>
		<pubDate>Wed, 16 Sep 2009 15:23:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.udidahan.com/?p=1042#comment-36714</guid>
		<description>Udi,

Regarding #49, could you expand on how you&#039;d implement user.AddItemToCartForProgram(program, item, quantity)?

Gilligan says he needs to check if a cart exists and create one if not. Where and how would this check be done? It seems to be cascading the lookup. In your original example, the service layer asks the ORM/repository to get a referrer. This is cool in the service layer, but in AddItemToCartForProgram, the domain object would have to do that for the cart, no?

I&#039;d love to see your general solution to this type of behaviour :-)</description>
		<content:encoded><![CDATA[<p>Udi,</p>
<p>Regarding #49, could you expand on how you&#8217;d implement user.AddItemToCartForProgram(program, item, quantity)?</p>
<p>Gilligan says he needs to check if a cart exists and create one if not. Where and how would this check be done? It seems to be cascading the lookup. In your original example, the service layer asks the ORM/repository to get a referrer. This is cool in the service layer, but in AddItemToCartForProgram, the domain object would have to do that for the cart, no?</p>
<p>I&#8217;d love to see your general solution to this type of behaviour <img src='http://www.udidahan.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: udidahan</title>
		<link>http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/comment-page-1/#comment-36665</link>
		<dc:creator>udidahan</dc:creator>
		<pubDate>Sat, 05 Sep 2009 14:06:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.udidahan.com/?p=1042#comment-36665</guid>
		<description>Gilligan,

Could you not do:

user.AddItemToCartForProgram(program, item, quantity);</description>
		<content:encoded><![CDATA[<p>Gilligan,</p>
<p>Could you not do:</p>
<p>user.AddItemToCartForProgram(program, item, quantity);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gilligan</title>
		<link>http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/comment-page-1/#comment-36663</link>
		<dc:creator>Gilligan</dc:creator>
		<pubDate>Fri, 04 Sep 2009 11:09:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.udidahan.com/?p=1042#comment-36663</guid>
		<description>I think my situation may not be appropriate domain driven behavior. 
It is more like this: a cart&#039;s identity is determined by two properties:  the current ordering program and the current user. So I will first get the program, then call a method program.GetCartForUser(user). This method will either create a new cart or retrieve an existing one. Then I will call cart.AddItem(item, quantity).</description>
		<content:encoded><![CDATA[<p>I think my situation may not be appropriate domain driven behavior.<br />
It is more like this: a cart&#8217;s identity is determined by two properties:  the current ordering program and the current user. So I will first get the program, then call a method program.GetCartForUser(user). This method will either create a new cart or retrieve an existing one. Then I will call cart.AddItem(item, quantity).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: udidahan</title>
		<link>http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/comment-page-1/#comment-36662</link>
		<dc:creator>udidahan</dc:creator>
		<pubDate>Fri, 04 Sep 2009 05:44:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.udidahan.com/?p=1042#comment-36662</guid>
		<description>Gilligan,

I&#039;m not sure I understand you fully.
If you&#039;re calling a method on your User object like PlaceItemInBasket(item), and it internally checks for the existence of a Cart object, creating it if it isn&#039;t there, I&#039;d say that that&#039;s OK. However, it&#039;s not really repository behavior since the Cart object would be designed as a property of the User object, though you could say it does serve as a factory.

Does that answer your question?</description>
		<content:encoded><![CDATA[<p>Gilligan,</p>
<p>I&#8217;m not sure I understand you fully.<br />
If you&#8217;re calling a method on your User object like PlaceItemInBasket(item), and it internally checks for the existence of a Cart object, creating it if it isn&#8217;t there, I&#8217;d say that that&#8217;s OK. However, it&#8217;s not really repository behavior since the Cart object would be designed as a property of the User object, though you could say it does serve as a factory.</p>
<p>Does that answer your question?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gilligan</title>
		<link>http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/comment-page-1/#comment-36659</link>
		<dc:creator>Gilligan</dc:creator>
		<pubDate>Thu, 03 Sep 2009 14:00:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.udidahan.com/?p=1042#comment-36659</guid>
		<description>I find myself in a lot of cases where the business model does not explicitly create entities, but will either pull an existing entity or create a new one. Example, the first time a user wants to place an item in the cart, there is no explicit &quot;Create cart&quot; process because we do not know whether or not we need a cart until a user adds an item to it or wants to view if anything is in their cart. Does it make sense in these cases to view the aggregate root also as a repository as well as a factory, where it simply searches its collection and if the cart does not exist it creates one? (this is what I currently do)</description>
		<content:encoded><![CDATA[<p>I find myself in a lot of cases where the business model does not explicitly create entities, but will either pull an existing entity or create a new one. Example, the first time a user wants to place an item in the cart, there is no explicit &#8220;Create cart&#8221; process because we do not know whether or not we need a cart until a user adds an item to it or wants to view if anything is in their cart. Does it make sense in these cases to view the aggregate root also as a repository as well as a factory, where it simply searches its collection and if the cart does not exist it creates one? (this is what I currently do)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: udidahan</title>
		<link>http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/comment-page-1/#comment-36610</link>
		<dc:creator>udidahan</dc:creator>
		<pubDate>Wed, 26 Aug 2009 05:40:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.udidahan.com/?p=1042#comment-36610</guid>
		<description>Mike,

The method on the previous entity can be viewed as the factory method of the new aggregate root. My recommendation is that if you&#039;re using the domain model pattern (not a foregone conclusion) you use this biogenetic approach (not a bad name).

:-)</description>
		<content:encoded><![CDATA[<p>Mike,</p>
<p>The method on the previous entity can be viewed as the factory method of the new aggregate root. My recommendation is that if you&#8217;re using the domain model pattern (not a foregone conclusion) you use this biogenetic approach (not a bad name).</p>
<p> <img src='http://www.udidahan.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Scott</title>
		<link>http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/comment-page-1/#comment-36609</link>
		<dc:creator>Mike Scott</dc:creator>
		<pubDate>Tue, 25 Aug 2009 21:08:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.udidahan.com/?p=1042#comment-36609</guid>
		<description>Udi,

Thanks, so the landlord would be entered as a part of the user or ad, and then the property as part of the landlord? Why not both as part of the user? Is that equally possible or is there a reason for not doing that?

Also, there has to be one FIRST root, right?

Finally, been re-reading Evans after digesting this post... He recommends creating aggregate roots using factories mainly, either classes or factory methods, or even just plain newing up an object if it&#039;s a trivial case. Just to clarify, are there any cases where you&#039;d recommend creating an aggregate root or do you always recommend creating them by adding to an existing entity?

Your technique is very organic - it reminds me of biogenesis, i.e. that life always spawns from previous life, that it never happens spontaneously, except at the very beginning... Perhaps biogenesis could be a good name for this DDD principle ;-)</description>
		<content:encoded><![CDATA[<p>Udi,</p>
<p>Thanks, so the landlord would be entered as a part of the user or ad, and then the property as part of the landlord? Why not both as part of the user? Is that equally possible or is there a reason for not doing that?</p>
<p>Also, there has to be one FIRST root, right?</p>
<p>Finally, been re-reading Evans after digesting this post&#8230; He recommends creating aggregate roots using factories mainly, either classes or factory methods, or even just plain newing up an object if it&#8217;s a trivial case. Just to clarify, are there any cases where you&#8217;d recommend creating an aggregate root or do you always recommend creating them by adding to an existing entity?</p>
<p>Your technique is very organic &#8211; it reminds me of biogenesis, i.e. that life always spawns from previous life, that it never happens spontaneously, except at the very beginning&#8230; Perhaps biogenesis could be a good name for this DDD principle <img src='http://www.udidahan.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: udidahan</title>
		<link>http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/comment-page-1/#comment-36608</link>
		<dc:creator>udidahan</dc:creator>
		<pubDate>Tue, 25 Aug 2009 19:54:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.udidahan.com/?p=1042#comment-36608</guid>
		<description>Mike,

Sounds like you&#039;re pointed in the right direction. The user who enters the landlord could be aggregate root. Or you might ask him if he saw an ad and that caused him to come in - in which case the ad would be the root.

My feeling would be the landlord would come first, and then the property.

Glad you&#039;re finding this approach useful.</description>
		<content:encoded><![CDATA[<p>Mike,</p>
<p>Sounds like you&#8217;re pointed in the right direction. The user who enters the landlord could be aggregate root. Or you might ask him if he saw an ad and that caused him to come in &#8211; in which case the ad would be the root.</p>
<p>My feeling would be the landlord would come first, and then the property.</p>
<p>Glad you&#8217;re finding this approach useful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Scott</title>
		<link>http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/comment-page-1/#comment-36607</link>
		<dc:creator>Mike Scott</dc:creator>
		<pubDate>Tue, 25 Aug 2009 11:25:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.udidahan.com/?p=1042#comment-36607</guid>
		<description>Hi Udi

Converting a referrer-&gt;visitor-&gt;user on a web page is a clear example of not creating an aggregate root because there are pre-existing entities with life cycles which culminate in the creation of a user entity.

However, what about the general case where you&#039;re entering some other data into a system where there is no pre-existing entity? For example, in a property letting system, a landlord walks off the street into your office and asks for you to market his property.

Since he&#039;s a new landlord not already on the system, you have to enter him for the first time. You also have to enter the property. So, leaving aside the question of which you&#039;d enter first, what is the initial aggregate root? Are you suggesting that the logged in user who deals with the landlord is the root? That the user aggregate should have a Landlords collection and the landlord should be added to that?

And to the second question, should either the landlord or the property be entered first and become the aggregate root to which the other is added, as in your example of jobs and job boards? Or should both be added to respective Landlords and Properties collections on the user aggregate?

I&#039;m enjoying the challenge of your &quot;don&#039;t create aggregate roots&quot; assertion. It requires a major reshuffle of common practice &amp; habits and some deeper thinking of the domain and DDD, which is a good thing! Please keep these posts coming! :-)</description>
		<content:encoded><![CDATA[<p>Hi Udi</p>
<p>Converting a referrer-&gt;visitor-&gt;user on a web page is a clear example of not creating an aggregate root because there are pre-existing entities with life cycles which culminate in the creation of a user entity.</p>
<p>However, what about the general case where you&#8217;re entering some other data into a system where there is no pre-existing entity? For example, in a property letting system, a landlord walks off the street into your office and asks for you to market his property.</p>
<p>Since he&#8217;s a new landlord not already on the system, you have to enter him for the first time. You also have to enter the property. So, leaving aside the question of which you&#8217;d enter first, what is the initial aggregate root? Are you suggesting that the logged in user who deals with the landlord is the root? That the user aggregate should have a Landlords collection and the landlord should be added to that?</p>
<p>And to the second question, should either the landlord or the property be entered first and become the aggregate root to which the other is added, as in your example of jobs and job boards? Or should both be added to respective Landlords and Properties collections on the user aggregate?</p>
<p>I&#8217;m enjoying the challenge of your &#8220;don&#8217;t create aggregate roots&#8221; assertion. It requires a major reshuffle of common practice &amp; habits and some deeper thinking of the domain and DDD, which is a good thing! Please keep these posts coming! <img src='http://www.udidahan.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
