<?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: NHibernate &#8211; Opinionated Style</title>
	<atom:link href="http://www.mattfreeman.co.uk/2009/01/nhibernate-opinionated-software/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mattfreeman.co.uk/2009/01/nhibernate-opinionated-software/</link>
	<description>A developer&#039;s rants and light bulb moments!</description>
	<lastBuildDate>Tue, 07 Sep 2010 00:49:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: mattcodes</title>
		<link>http://www.mattfreeman.co.uk/2009/01/nhibernate-opinionated-software/comment-page-1/#comment-14</link>
		<dc:creator>mattcodes</dc:creator>
		<pubDate>Tue, 10 Feb 2009 20:56:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattfreeman.co.uk/2009/01/nhibernate-opinionated-software/#comment-14</guid>
		<description>@q: Thanks for sharing. It&#039;s handy to know that the Linq extension for Count will shortcut where it can, nice!

@Chris: Where different uses of the domain model require a variation in rules or where the rules are not stable then I somewhat agree that embebbing the rules may make make such undesireable.  However for rules that are always applicable then these should exists in the domain model, your domain model should rich rather than weak. You could have both embedded and flexible rules, how they are injected is outside scope of this topic. 

With regards to immediate validation, I disagree that you must surround every operation with exception catching, I&#039;ll illustrate the technique and more importantly the concepts in a blog post forthcoming if you can hand on a few days.</description>
		<content:encoded><![CDATA[<p>@q: Thanks for sharing. It&#8217;s handy to know that the Linq extension for Count will shortcut where it can, nice!</p>
<p>@Chris: Where different uses of the domain model require a variation in rules or where the rules are not stable then I somewhat agree that embebbing the rules may make make such undesireable.  However for rules that are always applicable then these should exists in the domain model, your domain model should rich rather than weak. You could have both embedded and flexible rules, how they are injected is outside scope of this topic. </p>
<p>With regards to immediate validation, I disagree that you must surround every operation with exception catching, I&#8217;ll illustrate the technique and more importantly the concepts in a blog post forthcoming if you can hand on a few days.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Marisic</title>
		<link>http://www.mattfreeman.co.uk/2009/01/nhibernate-opinionated-software/comment-page-1/#comment-11</link>
		<dc:creator>Chris Marisic</dc:creator>
		<pubDate>Tue, 03 Feb 2009 17:08:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattfreeman.co.uk/2009/01/nhibernate-opinionated-software/#comment-11</guid>
		<description>I am one of the people that full disagrees with #4. Validation should be regulated into it&#039;s own services, combining it with your domain objects make your code hard to test, spreads out the validation logic, makes complex validation nearly impossible and just leads to poor and unmaintainable business code.

Business code should not be inside the domain layer!

Now I do have some wiggle room on that and if you have simple validations such as Age must be &gt; 0, or regular expression validators that make sure this string field for zip code really is a zip code, I can accept that in a domain layer.

I still think it&#039;s bad practice to throw exceptions from properties in any situation though because then every single operation you ever do with your object you MUST surround it with try/catch, which isn&#039;t really acceptable in my opinion which is why it makes sense to not combine domain objects + validation. But if you must atleast take advantage of enterprise library&#039;s validation classes and do screening on Validation.Validate(object) instead of throwing random exceptions from setters.</description>
		<content:encoded><![CDATA[<p>I am one of the people that full disagrees with #4. Validation should be regulated into it&#8217;s own services, combining it with your domain objects make your code hard to test, spreads out the validation logic, makes complex validation nearly impossible and just leads to poor and unmaintainable business code.</p>
<p>Business code should not be inside the domain layer!</p>
<p>Now I do have some wiggle room on that and if you have simple validations such as Age must be &gt; 0, or regular expression validators that make sure this string field for zip code really is a zip code, I can accept that in a domain layer.</p>
<p>I still think it&#8217;s bad practice to throw exceptions from properties in any situation though because then every single operation you ever do with your object you MUST surround it with try/catch, which isn&#8217;t really acceptable in my opinion which is why it makes sense to not combine domain objects + validation. But if you must atleast take advantage of enterprise library&#8217;s validation classes and do screening on Validation.Validate(object) instead of throwing random exceptions from setters.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: q</title>
		<link>http://www.mattfreeman.co.uk/2009/01/nhibernate-opinionated-software/comment-page-1/#comment-10</link>
		<dc:creator>q</dc:creator>
		<pubDate>Tue, 03 Feb 2009 14:07:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattfreeman.co.uk/2009/01/nhibernate-opinionated-software/#comment-10</guid>
		<description>&quot;...available via Linq extensions method of Count() - perhaps not as efficient but I’m willing to make this tiny sacrifice...&quot;

Enumerable.Count extension method actually has a shortcut for ICollection interface - it just returns Count property without iterating the collection.</description>
		<content:encoded><![CDATA[<p>&#8220;&#8230;available via Linq extensions method of Count() &#8211; perhaps not as efficient but I’m willing to make this tiny sacrifice&#8230;&#8221;</p>
<p>Enumerable.Count extension method actually has a shortcut for ICollection interface &#8211; it just returns Count property without iterating the collection.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reflective Perspective - Chris Alcock &#187; The Morning Brew #278</title>
		<link>http://www.mattfreeman.co.uk/2009/01/nhibernate-opinionated-software/comment-page-1/#comment-9</link>
		<dc:creator>Reflective Perspective - Chris Alcock &#187; The Morning Brew #278</dc:creator>
		<pubDate>Tue, 03 Feb 2009 08:16:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattfreeman.co.uk/2009/01/nhibernate-opinionated-software/#comment-9</guid>
		<description>[...] NHibernate - Opinionated Style - Matt Freeman looks at some of the enforce style that NHibernate brings to your code, and talks about how you can make these conventions nicer. [...]</description>
		<content:encoded><![CDATA[<p>[...] NHibernate &#8211; Opinionated Style &#8211; Matt Freeman looks at some of the enforce style that NHibernate brings to your code, and talks about how you can make these conventions nicer. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DotNetShoutout</title>
		<link>http://www.mattfreeman.co.uk/2009/01/nhibernate-opinionated-software/comment-page-1/#comment-8</link>
		<dc:creator>DotNetShoutout</dc:creator>
		<pubDate>Mon, 02 Feb 2009 12:42:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.mattfreeman.co.uk/2009/01/nhibernate-opinionated-software/#comment-8</guid>
		<description>&lt;strong&gt;NHibernate - Opinionated Style &#124; Matt Freeman&#039;s Coding Blog...&lt;/strong&gt;

Thank you for submitting this cool story - Trackback from DotNetShoutout...</description>
		<content:encoded><![CDATA[<p><strong>NHibernate &#8211; Opinionated Style | Matt Freeman&#8217;s Coding Blog&#8230;</strong></p>
<p>Thank you for submitting this cool story &#8211; Trackback from DotNetShoutout&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
