<?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: Improving your validation code &#8212; a refactoring exercise</title>
	<atom:link href="http://jonkruger.com/blog/2010/03/11/improving-your-validation-code-a-refactoring-exercise/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonkruger.com/blog/2010/03/11/improving-your-validation-code-a-refactoring-exercise/</link>
	<description></description>
	<pubDate>Fri, 18 May 2012 01:22:10 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Jon Kruger</title>
		<link>http://jonkruger.com/blog/2010/03/11/improving-your-validation-code-a-refactoring-exercise/comment-page-1/#comment-4883</link>
		<dc:creator>Jon Kruger</dc:creator>
		<pubDate>Fri, 12 Mar 2010 14:24:05 +0000</pubDate>
		<guid isPermaLink="false">http://jonkruger.com/blog/?p=504#comment-4883</guid>
		<description>@Darrell,

Actually I do pretty much exactly what you outlined in your comment.  I just didn't put an example of it in the post (I think I just forgot!).  Thanks for pointing that out.</description>
		<content:encoded><![CDATA[<p>@Darrell,</p>
<p>Actually I do pretty much exactly what you outlined in your comment.  I just didn&#8217;t put an example of it in the post (I think I just forgot!).  Thanks for pointing that out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Darrell Mozingo</title>
		<link>http://jonkruger.com/blog/2010/03/11/improving-your-validation-code-a-refactoring-exercise/comment-page-1/#comment-4882</link>
		<dc:creator>Darrell Mozingo</dc:creator>
		<pubDate>Fri, 12 Mar 2010 14:19:01 +0000</pubDate>
		<guid isPermaLink="false">http://jonkruger.com/blog/?p=504#comment-4882</guid>
		<description>I like how you stepped through the though process here - it's a lot better than showing the end result. I wouldn't worry about the method name underscores, either. I'm starting to use them in more and more of my code (and if you ever get a chance to take JP Boodhoo's Nothin' But .Net Bootcamp, you'll get used to them real quick!).

Have you thought about using a generic specification?

public interface ISpecification {
  bool IsSatisfiedBy(T entity);
}

Then have your registry/IoC tool look for all ISpecification's and run through them, passing in your order. You could modify it to take in the ValidationErrorsCollection and each specification could add messages to it. Then you can break up your order validator a bit (though I know you said you weren't too concerned about it), along with your tests. It'd help when a certain validation rule gets a bit too large or complex.

Just a thought.</description>
		<content:encoded><![CDATA[<p>I like how you stepped through the though process here - it&#8217;s a lot better than showing the end result. I wouldn&#8217;t worry about the method name underscores, either. I&#8217;m starting to use them in more and more of my code (and if you ever get a chance to take JP Boodhoo&#8217;s Nothin&#8217; But .Net Bootcamp, you&#8217;ll get used to them real quick!).</p>
<p>Have you thought about using a generic specification?</p>
<p>public interface ISpecification {<br />
  bool IsSatisfiedBy(T entity);<br />
}</p>
<p>Then have your registry/IoC tool look for all ISpecification&#8217;s and run through them, passing in your order. You could modify it to take in the ValidationErrorsCollection and each specification could add messages to it. Then you can break up your order validator a bit (though I know you said you weren&#8217;t too concerned about it), along with your tests. It&#8217;d help when a certain validation rule gets a bit too large or complex.</p>
<p>Just a thought.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

