<?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: What I want from an ORM</title>
	<atom:link href="http://lostechies.com/colinjack/2008/10/23/what-i-want-from-an-orm/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/colinjack/2008/10/23/what-i-want-from-an-orm/</link>
	<description>Just another LosTechies site</description>
	<lastBuildDate>Tue, 24 Aug 2010 06:44:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: Colin Jack</title>
		<link>http://lostechies.com/colinjack/2008/10/23/what-i-want-from-an-orm/#comment-5</link>
		<dc:creator>Colin Jack</dc:creator>
		<pubDate>Fri, 24 Oct 2008 11:38:14 +0000</pubDate>
		<guid isPermaLink="false">/blogs/colinjack/archive/2008/10/23/what-i-want-from-an-orm.aspx#comment-5</guid>
		<description>Hi Ian,

Good comment/point and you could be right about 4, I know it’s questionable and if we had 3 then it wouldn&#039;t be an issue. 

However if we don’t have 3 then I like the idea of switching off the UOW because otherwise I&#039;m relying on convention to ensure that people validate aggregates before persistence or have to do some incredibly nasty workarounds to make that automatic (such as exceptions from interceptors or whatever). 

On the aggregate validation angle, whilst I like the idea of having a repository behave like an in-memory collection doing so does make the aggregate invariants rule hard to apply:

“When a change to any object within the aggregate boundary is committed, all invariants of the whole aggregate must be specified”

If we follow this rule but also allow clients to update the aggregate piecemeal, rather than following Greg Young’s always valid approach, then committing does become an event that we are interested in. Unfortunately if the UOW takes care of it all for us and doesn’t give us a nice way to hook in then we’re left, primarily, with conventions.

I also find that the UOW is not a feature I find massively useful when working with DDD since I know which aggregates are being affected in a particular request. I thus don&#039;t see losing it as being a big deal.

So yeah I agree with you in general and maybe I shouldn’t have added 4 :)

Oh and Add/Remove, yeah I like that approach but these days most people seem to use freely available repository interfaces that tend to have Save/Update.

Ta,

Colin</description>
		<content:encoded><![CDATA[<p>Hi Ian,</p>
<p>Good comment/point and you could be right about 4, I know it’s questionable and if we had 3 then it wouldn&#8217;t be an issue. </p>
<p>However if we don’t have 3 then I like the idea of switching off the UOW because otherwise I&#8217;m relying on convention to ensure that people validate aggregates before persistence or have to do some incredibly nasty workarounds to make that automatic (such as exceptions from interceptors or whatever). </p>
<p>On the aggregate validation angle, whilst I like the idea of having a repository behave like an in-memory collection doing so does make the aggregate invariants rule hard to apply:</p>
<p>“When a change to any object within the aggregate boundary is committed, all invariants of the whole aggregate must be specified”</p>
<p>If we follow this rule but also allow clients to update the aggregate piecemeal, rather than following Greg Young’s always valid approach, then committing does become an event that we are interested in. Unfortunately if the UOW takes care of it all for us and doesn’t give us a nice way to hook in then we’re left, primarily, with conventions.</p>
<p>I also find that the UOW is not a feature I find massively useful when working with DDD since I know which aggregates are being affected in a particular request. I thus don&#8217;t see losing it as being a big deal.</p>
<p>So yeah I agree with you in general and maybe I shouldn’t have added 4 <img src='http://lostechies.com/colinjack/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Oh and Add/Remove, yeah I like that approach but these days most people seem to use freely available repository interfaces that tend to have Save/Update.</p>
<p>Ta,</p>
<p>Colin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ian Cooper</title>
		<link>http://lostechies.com/colinjack/2008/10/23/what-i-want-from-an-orm/#comment-4</link>
		<dc:creator>Ian Cooper</dc:creator>
		<pubDate>Fri, 24 Oct 2008 07:01:02 +0000</pubDate>
		<guid isPermaLink="false">/blogs/colinjack/archive/2008/10/23/what-i-want-from-an-orm.aspx#comment-4</guid>
		<description>HI Colin,

Thought I would comment at your new home.

I agree with a lot of what you are saying (feeling your pain on 5 and 6)

I&#039;m not sure that I agree with 4. My understanding of a repository is that it has collection semantics i.e. appears like an in-memory collection would. 

With an in-memory collection I may add or remove items, but I don&#039;t ever update them. With an in-memory collection I don&#039;t have to re-add, just because I add a child to the parent that is already stored in the list. 

Turning off unit-of-work would seem to me to break the collection semantics approach of a repository, because you now have to perform update operations. That means that the knowledge that I am using some sort of  external persistent store bleeds into my domain model. I don&#039;t really want that. I like what unit of work gives me in this regard, a lack of difference between in-memory and persistent storage.

I recently changed our repository base class to have an op named Add instead of Save because folks here got confused as to when they had to tell the ORM about their changes. If you use Add and Remove instead of Save and Delete its is a lot more obvious when you should use them.


</description>
		<content:encoded><![CDATA[<p>HI Colin,</p>
<p>Thought I would comment at your new home.</p>
<p>I agree with a lot of what you are saying (feeling your pain on 5 and 6)</p>
<p>I&#8217;m not sure that I agree with 4. My understanding of a repository is that it has collection semantics i.e. appears like an in-memory collection would. </p>
<p>With an in-memory collection I may add or remove items, but I don&#8217;t ever update them. With an in-memory collection I don&#8217;t have to re-add, just because I add a child to the parent that is already stored in the list. </p>
<p>Turning off unit-of-work would seem to me to break the collection semantics approach of a repository, because you now have to perform update operations. That means that the knowledge that I am using some sort of  external persistent store bleeds into my domain model. I don&#8217;t really want that. I like what unit of work gives me in this regard, a lack of difference between in-memory and persistent storage.</p>
<p>I recently changed our repository base class to have an op named Add instead of Save because folks here got confused as to when they had to tell the ORM about their changes. If you use Add and Remove instead of Save and Delete its is a lot more obvious when you should use them.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
