<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>Architecture</title><link>http://blogs.interknowlogy.com/timmccarthy/category/28.aspx</link><description>Architecture</description><dc:language>en-US</dc:language><generator>.Text Version 0.95.2004.111</generator><item><dc:creator>Tim McCarthy</dc:creator><title>My 11/6/2007 .NET Developers Group Presentation</title><link>http://blogs.interknowlogy.com/timmccarthy/archive/2007/11/07/22445.aspx</link><pubDate>Wed, 07 Nov 2007 12:50:00 GMT</pubDate><guid>http://blogs.interknowlogy.com/timmccarthy/archive/2007/11/07/22445.aspx</guid><description>&lt;p&gt;Here are the &lt;A href="http://blogs.interknowlogy.com/downloads/timmccarthy/itarc2007/Building%20an%20Offline%20Smart%20Client%20using%20Domain-Driven%20Design%20Principles.zip" target="_blank"&gt;slides&lt;/a&gt; and here is the &lt;a href="http://www.codeplex.com/dddpds/SourceControl/ListDownloadableCommits.aspx" target="_blank"&gt;code&lt;/a&gt; from my presentation yesterday.  Thanks to everyone who attended, I thoroughly I enjoyed discussing my upcoming book with you guys!&lt;/p&gt;
&lt;p&gt;By the way, here is the link to my book on the Wiley web site:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470147563.html"&gt;http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470147563.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;&lt;img src ="http://blogs.interknowlogy.com/timmccarthy/aggbug/22445.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Tim McCarthy</dc:creator><title>I am writing a book on Domain-Driven Design</title><link>http://blogs.interknowlogy.com/timmccarthy/archive/2007/03/06/12180.aspx</link><pubDate>Tue, 06 Mar 2007 23:07:00 GMT</pubDate><guid>http://blogs.interknowlogy.com/timmccarthy/archive/2007/03/06/12180.aspx</guid><description>&lt;p&gt;I have been talking to people about this for a while, so I figured I&amp;#8217;d blog about it too.  Actually, I promised my friends over at the &lt;a href="http://tech.groups.yahoo.com/group/domaindrivendesign/" target="_blank"&gt;Domain-Driven Design Yahoo group&lt;/a&gt; that I would!  The full title of the book is .NET Domain-Driven Design with C#: Problem-Design-Solution, and it will be published by Wiley Publishing, Inc.&lt;/p&gt;
&lt;p&gt;The idea behind the book is that it will be a case-study book&amp;#8230;a real-world application that uses Domain-Driven Design (DDD) concepts.  After reading other bloggers&amp;#8217; posts, and hearing people ask for real-world examples on the DDD Yahoo group, I have decided to write a book that addresses this exact topic.  The book is due to be completed at the end of the year, and will probably be out in early 2008.&lt;/p&gt;
&lt;p&gt;My plan is to put some of the issues I run into on this blog and/or the DDD Yahoo group and see what other people have to say about their solutions to similar problems.&lt;/p&gt;&lt;img src ="http://blogs.interknowlogy.com/timmccarthy/aggbug/12180.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Tim McCarthy</dc:creator><title>How to Create Custom Code Analysis Rules for VSTS 2005</title><link>http://blogs.interknowlogy.com/timmccarthy/archive/2007/02/13/11543.aspx</link><pubDate>Tue, 13 Feb 2007 13:38:00 GMT</pubDate><guid>http://blogs.interknowlogy.com/timmccarthy/archive/2007/02/13/11543.aspx</guid><description>&lt;H2 style="MARGIN: 12pt 0in 3pt"&gt;&lt;EM&gt;Building New Rules&lt;/EM&gt;&lt;/H2&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;The first step is to make sure there is not an already existing rule that is doing what you are trying to do!&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;?xml:namespace prefix = o /&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Use the &lt;A href="http://blogs.interknowlogy.com/downloads/timmccarthy/IK.CodeAnalysis.Rules.zip" target=_blank&gt;IK.CodeAnalysis.Rules solution&lt;/A&gt; to add new classes to the IK.CodeAnalysis.Rules project inside of the solution.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Each new class will correspond to a new rule.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Add a new rule element to the Rules.xml file.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Follow the examples from the rules that are already there.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;IMG alt="" hspace=0 src="/downloads/timmccarthy/images/CodeAnalysis/figure_1.jpg" border=0&gt;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;?xml:namespace prefix = v /&gt;&lt;v:shapetype id=_x0000_t75 path="m@4@5l@4@11@9@11@9@5xe" stroked="f" filled="f" o:preferrelative="t" o:spt="75" coordsize="21600,21600"&gt;&lt;v:stroke joinstyle="miter"&gt;&lt;/v:stroke&gt;&lt;v:formulas&gt;&lt;v:f eqn="if lineDrawn pixelLineWidth 0"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum @0 1 0"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum 0 0 @1"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @2 1 2"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @3 21600 pixelWidth"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @3 21600 pixelHeight"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum @0 0 1"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @6 1 2"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @7 21600 pixelWidth"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum @8 21600 0"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @7 21600 pixelHeight"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum @10 21600 0"&gt;&lt;/v:f&gt;&lt;/v:formulas&gt;&lt;v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"&gt;&lt;/v:path&gt;&lt;o:lock aspectratio="t" v:ext="edit"&gt;&lt;/o:lock&gt;&lt;/v:shapetype&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;FONT face="Times New Roman"&gt;Figure 1.1&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Rules.xml file&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;All new classes must inherit from the BaseRule class.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Make sure to add a private static class called &amp;#8220;Constants&amp;#8221; in the new Rule class.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This is where the name of your rule as well as its resolution name will go.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;See the example rule classes in the project for reference.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Make sure that the Resolution element&amp;#8217;s Name attribute is what you reference in the new Rule class as well as the Rule element&amp;#8217;s TypeName attribute.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;These values should correspond to what both of the values are in the RuleName and ResolutionName constants in the private static Constants class of the new Rule.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Feel free to put any other string literals into the Constants class.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;IMG alt="" hspace=0 src="/downloads/timmccarthy/images/CodeAnalysis/figure_2.jpg"  border=0&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;FONT face="Times New Roman"&gt;Figure 1.2&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The Constants class&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Next, figure out what scope the new rule applies to; it may apply at several levels, such as Field, Property, Parameter, Method, etc.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;For whatever levels your rule applies, override the appropriate Visit methods from the BaseIntrospectionRule class.&lt;/P&gt;
&lt;H3 style="MARGIN: 12pt 0in 3pt"&gt;The &amp;#8220;Visit&amp;#8221; Methods&lt;/H3&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;The BaseRule class extends the BaseIntrospectionRule class, which in turn extends the StandardVisitor class.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;There are over 140 Visit methods that the StandardVisitor class calls during a rule check operation.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;What this means is that any Visit methods that are implemented in the new Rule class will be called by the rule framework.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This is great because it allows rule developers to only focus on the parts of an assembly&amp;#8217;s IL that they care about, such as all methods, or all private fields, etc.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In order to trigger an error or warning to appear from a rule that has been broken, a call must be made to the BaseRule.AddProblem method.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;In Figure 1.3, a call to AddProblem is made when a private field has been flagged as having a prefix in front of it.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;IMG alt="" hspace=0 src="/downloads/timmccarthy/images/CodeAnalysis/figure_3.jpg"  border=0&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;FONT face="Times New Roman"&gt;Figure 1.3&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;An example of overriding the VisitField method&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/I&gt;&lt;/P&gt;
&lt;H2 style="MARGIN: 12pt 0in 3pt"&gt;&lt;EM&gt;Debugging Rules&lt;/EM&gt;&lt;/H2&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Follow the instructions outlined in #13 of the Resources section.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In the IK.CodeAnalysis.Rules solution, there is a file named CommandLine.txt which contains a sample command line for debugging the custom rules in the solution.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;There is also an FxCop project file in the solution, fxcoptest.fxcop, which is necessary for debugging.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In order to get debugging working, the rule developer will need to modify the paths referenced in both of these files to point to the correct locations on their machine.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Once everything has been modified correctly, copy and paste the text from the CommandLine.txt file into a command-prompt window, and then run it.&lt;/P&gt;
&lt;H2 style="MARGIN: 12pt 0in 3pt"&gt;&lt;EM&gt;Deploying Rules&lt;/EM&gt;&lt;/H2&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;In order to deploy the IK rules, the IK.CodeAnalysis.Rules.dll assembly file must be copied to the C:\Program Files\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop\Rules directory on each machine where the rules are to be run.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;That&amp;#8217;s it, Visual Studio will load up and process all of the assemblies in this directory.&lt;/P&gt;
&lt;H2 style="MARGIN: 12pt 0in 3pt"&gt;&lt;EM&gt;Suppressing Rules&lt;/EM&gt;&lt;/H2&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;There are some cases where it will be necessary to allow a rule violation in your code.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;A typical example might be a rule violation that is more of a design suggestion, instead of an actual violation, such as having a &amp;#8220;GetXYZ&amp;#8221; method that returns a certain type.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This will result in a rule violation stating that the method be changed to a property, but you may have a very good reason to keep it as a method.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In those types of cases the rules can be suppressed, but should be suppressed in code using the System.Diagnostics.CodeAnalysis.SuppressMessageAttribute attribute.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Here is an example of what this looks like in code:&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&lt;/FONT&gt;&lt;/o:p&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;IMG alt="" hspace=0 src="/downloads/timmccarthy/images/CodeAnalysis/figure_4.jpg" border=0&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;FONT face="Times New Roman"&gt;Figure 1.4 Suppressing a Rule&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;More information about this attribute can be found &lt;A href="http://msdn2.microsoft.com/en-us/library/ms182068(VS.80).aspx"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;H2 style="MARGIN: 12pt 0in 3pt"&gt;&lt;EM&gt;Resources:&lt;/EM&gt;&lt;/H2&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;The very first resource any new rule developer should look at is #6 (Writing Custom FxCop Rules by Guy Smith-Ferrier) in the list below.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This is a pdf version of a PowerPoint presentation that explains the process of building rules very well.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman"&gt;1.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/fxcop/archive/2006/11/16/faq-how-do-i-share-managed-code-analysis-rule-settings-over-multiple-projects-david-kean.aspx"&gt;&lt;FONT face="Times New Roman"&gt;http://blogs.msdn.com/fxcop/archive/2006/11/16/faq-how-do-i-share-managed-code-analysis-rule-settings-over-multiple-projects-david-kean.aspx&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman"&gt;2.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/fxcop/"&gt;&lt;FONT face="Times New Roman"&gt;http://blogs.msdn.com/fxcop/&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman"&gt;3.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;A href="http://www.gotdotnet.com/community/usersamples/default.aspx?ProductDropDownList=FxCop&amp;amp;SortDirection=Desc&amp;amp;SortColumnName=CreationDate"&gt;&lt;FONT face="Times New Roman"&gt;http://www.gotdotnet.com/community/usersamples/default.aspx?ProductDropDownList=FxCop&amp;amp;SortDirection=Desc&amp;amp;SortColumnName=CreationDate&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman"&gt;4.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;A href="http://www.gotdotnet.com/team/fxcop/"&gt;&lt;FONT face="Times New Roman"&gt;http://www.gotdotnet.com/team/fxcop/&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman"&gt;5.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/fxcop/archive/2007/01/22/faq-what-exception-should-i-throw-instead-of-the-reserved-exceptions-found-by-donotraisereservedexceptiontypes.aspx"&gt;&lt;FONT face="Times New Roman"&gt;http://blogs.msdn.com/fxcop/archive/2007/01/22/faq-what-exception-should-i-throw-instead-of-the-reserved-exceptions-found-by-donotraisereservedexceptiontypes.aspx&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman"&gt;6.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;A href="http://www.guysmithferrier.com/downloads/FxCop.pdf"&gt;&lt;FONT face="Times New Roman"&gt;http://www.guysmithferrier.com/downloads/FxCop.pdf&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman"&gt;7.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;A href="http://davidkean.net/archive/2004/08/09/145.aspx"&gt;&lt;FONT face="Times New Roman"&gt;http://davidkean.net/archive/2004/08/09/145.aspx&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman"&gt;8.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/msdnmag/issues/04/06/Bugslayer/"&gt;&lt;FONT face="Times New Roman"&gt;http://msdn.microsoft.com/msdnmag/issues/04/06/Bugslayer/&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman"&gt;9.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;A href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1090172&amp;amp;SiteID=1"&gt;&lt;FONT face="Times New Roman"&gt;http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1090172&amp;amp;SiteID=1&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman"&gt;10.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;A href="http://davidkean.net/articles/BaseRule.aspx"&gt;&lt;FONT face="Times New Roman"&gt;http://davidkean.net/articles/BaseRule.aspx&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman"&gt;11.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;A href="http://www.codeproject.com/cs/algorithms/Not_Used_Analysis.asp?df=100&amp;amp;forumid=332089&amp;amp;exp=0&amp;amp;select=1783417"&gt;&lt;FONT face="Times New Roman"&gt;http://www.codeproject.com/cs/algorithms/Not_Used_Analysis.asp?df=100&amp;amp;forumid=332089&amp;amp;exp=0&amp;amp;select=1783417&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman"&gt;12.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;A href="http://dotnetjunkies.com/WebLog/tim.weaver/archive/2005/01/12/43651.aspx"&gt;&lt;FONT face="Times New Roman"&gt;http://dotnetjunkies.com/WebLog/tim.weaver/archive/2005/01/12/43651.aspx&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman"&gt;13.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;A href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1090172&amp;amp;SiteID=1"&gt;&lt;FONT face="Times New Roman"&gt;http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1090172&amp;amp;SiteID=1&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;&lt;img src ="http://blogs.interknowlogy.com/timmccarthy/aggbug/11543.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Tim McCarthy</dc:creator><title>A Composite Specification Pattern Implementation in .NET 2.0</title><link>http://blogs.interknowlogy.com/timmccarthy/archive/2007/01/22/10863.aspx</link><pubDate>Mon, 22 Jan 2007 16:15:00 GMT</pubDate><guid>http://blogs.interknowlogy.com/timmccarthy/archive/2007/01/22/10863.aspx</guid><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: center" align=center&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;U&gt;&lt;FONT face="Times New Roman"&gt;.NET 2.0 Composite Specification Pattern Implementation&lt;?xml:namespace prefix = o /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/U&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman"&gt;According to &lt;A href="http://www.martinfowler.com/" target=_blank&gt;Fowler&lt;/A&gt; and &lt;A href="http://domainlanguage.com/about/ericevans.html" target=_blank&gt;Evans&lt;/A&gt;, the idea of using Specifications is to separate the statement of how to match a candidate, from the candidate object that it is matched against.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The main motivation pattern is to be able to select a list of objects from another list using various criteria in a very flexible, robust way.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;A nice side benefit of using Specifications is that they can be used for object validation/constraints as well as for building objects to order (like in a &lt;/FONT&gt;&lt;A href="http://en.wikipedia.org/wiki/Factory_pattern" target=_blank&gt;Factory&lt;/A&gt;&lt;FONT face="Times New Roman"&gt;).&amp;nbsp; I was first introduced to this pattern from reading Eric Evans&amp;#8217; excellent book, &lt;A href="http://domaindrivendesign.org/books/index.html#DDD" target=_blank&gt;Domain-Driven Design&lt;/A&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman"&gt;I have implemented the&amp;nbsp;&lt;/FONT&gt;&lt;A href="http://www.martinfowler.com/apsupp/spec.pdf" target=_blank&gt;Specification pattern&lt;/A&gt;&lt;FONT face="Times New Roman"&gt; using the&amp;nbsp;&lt;/FONT&gt;&lt;A href="http://en.wikipedia.org/wiki/Composite_pattern" target=_blank&gt;Composite pattern&lt;/A&gt;&lt;FONT face="Times New Roman"&gt; in order to provide the ability to combine Specifications in various ways.&amp;nbsp; I really needed this in a project, and I was surprised that I could not find any .NET implementations out in the blogoshpere, so I went ahead and wrote my own, with a little help from Reflection and Generics.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman"&gt;Here is the basic diagram of the top-level classes:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;A href="http://blogs.interknowlogy.com/downloads/timmccarthy/images/CompositeSpecificationClassDiagram.jpg" target=_blank&gt;&lt;IMG height=558 alt=LeafNodesClassDiagram hspace=0 src="/downloads/timmccarthy/images/CompositeSpecificationClassDiagram.jpg" width=640 border=0&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&lt;/FONT&gt;&lt;/o:p&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman"&gt;For the AndSpecification and OrSpecification classes, they both take two ISpecification instances in their constructors, which represent the classes to be AND&amp;#8217;ed or OR&amp;#8217;ed together.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman"&gt;Here is a diagram of the Leaf-node classes of the Composite:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;A href="http://blogs.interknowlogy.com/downloads/timmccarthy/images/LeafNodesClassDiagram.jpg" target=_blank&gt;&lt;IMG height=558 alt=LeafNodesClassDiagram hspace=0 src="/downloads/timmccarthy/images/LeafNodesClassDiagram.jpg" width=640 border=0&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman"&gt;As you can see in this diagram, every Leaf is actually a Composite, which makes it very easy to combine Specifications.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Below is a code example of how to combine specifications and use them:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;///&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SUMMARY&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;///&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;A test for IsSatisfiedBy (TCandidate)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;///&lt;/SUMMARY&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;[&lt;SPAN style="COLOR: teal"&gt;TestMethod&lt;/SPAN&gt;()]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; CustomerIsSatisfiedByEqualAndStartsWithTest()&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;TestCustomer&lt;/SPAN&gt; candidate = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: teal"&gt;TestCustomer&lt;/SPAN&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;candidate.FirstName = &lt;SPAN style="COLOR: maroon"&gt;"Tim"&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;candidate.LastName = &lt;SPAN style="COLOR: maroon"&gt;"McCarthy"&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; expected = &lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;bool&lt;/SPAN&gt; actual = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: teal"&gt;EqualSpecification&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: teal"&gt;TestCustomer&lt;/SPAN&gt;, &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&amp;gt;(&lt;SPAN style="COLOR: maroon"&gt;"FirstName"&lt;/SPAN&gt;, &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;"Tim"&lt;/SPAN&gt;).And(&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: teal"&gt;StartsWithSpecification&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: teal"&gt;TestCustomer&lt;/SPAN&gt;, &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&amp;gt;(&lt;SPAN style="COLOR: maroon"&gt;"LastName"&lt;/SPAN&gt;, &lt;SPAN style="COLOR: maroon"&gt;"M"&lt;/SPAN&gt;)).IsSatisfiedBy(candidate);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: teal"&gt;Assert&lt;/SPAN&gt;.AreEqual(expected, actual, &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: maroon"&gt;"The CompositeSpecification did not return the expected value."&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face="Times New Roman"&gt;In this example, an EqualSpecification is combined with a StartsWithSpecification to perform two tests on the candidate object, which happens to be a TestCustomer type.&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face="Times New Roman"&gt;The first test specifies that the FirstName property of the TestCustomer instance (the candidate) is equal to &amp;#8220;Tim&amp;#8221;.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The second test specifies that the LastName property of the TestCustomer instance (the candidate) starts with the character &amp;#8220;M&amp;#8221;.&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face="Times New Roman"&gt;The power of this is that the tests by themselves are very granular and easy to understand, yet also very easy to combine and execute, as evidenced by how the code sample combined two specifications on one line of code.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face="Times New Roman"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face="Times New Roman"&gt;The code for the implementation (as well as a sample application) can be found &lt;A href="http://blogs.interknowlogy.com/downloads/timmccarthy/DDDTalkOC/Code.zip"&gt;here&lt;/A&gt;.&amp;nbsp; Enjoy!&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-no-proof: yes"&gt;[5/22/2007:&amp;nbsp; I moved the code for this project over to CodePlex.&amp;nbsp; It can now be accessed here:&amp;nbsp; &lt;A href="http://www.codeplex.com/spec"&gt;http://www.codeplex.com/spec&lt;/A&gt;]&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face="Times New Roman"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-no-proof: yes"&gt;&lt;FONT face="Times New Roman"&gt;I definitely welcome any feedback on this code as well.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;img src ="http://blogs.interknowlogy.com/timmccarthy/aggbug/10863.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Tim McCarthy</dc:creator><title>My talk on Domain Driven Design for the OC C#/VB.NET/Architecture User Groups</title><link>http://blogs.interknowlogy.com/timmccarthy/archive/2006/12/13/9534.aspx</link><pubDate>Wed, 13 Dec 2006 08:51:00 GMT</pubDate><guid>http://blogs.interknowlogy.com/timmccarthy/archive/2006/12/13/9534.aspx</guid><description>&lt;p&gt;First off, I have to say that I had a great audience, very intuitive and sharp!  I am posting my slides and code again (even though I just gave this talk last week in San Diego) since I went through and added a bunch of stuff to it.  &lt;/p&gt;
&lt;p&gt;Here are my latest &lt;A href="http://blogs.interknowlogy.com/downloads/timmccarthy/DDDTalkOC/DDD.zip" target="_blank"&gt;slides&lt;/a&gt; and &lt;A href="http://blogs.interknowlogy.com/downloads/timmccarthy/DDDTalkOC/Code.zip" target="_blank"&gt;code&lt;/a&gt;.  As promised, in the code contains a full-blown .NET implementation of the Composite Specification pattern using .NET Generics.&lt;/p&gt;
&lt;p&gt;Enjoy!&lt;/p&gt;&lt;img src ="http://blogs.interknowlogy.com/timmccarthy/aggbug/9534.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Tim McCarthy</dc:creator><title>My talk on Domain Driven Design for San Diego .NET Developers Group</title><link>http://blogs.interknowlogy.com/timmccarthy/archive/2006/12/06/9351.aspx</link><pubDate>Wed, 06 Dec 2006 11:34:00 GMT</pubDate><guid>http://blogs.interknowlogy.com/timmccarthy/archive/2006/12/06/9351.aspx</guid><description>&lt;p&gt;That was a fun talk!  Here are my &lt;A href="http://blogs.interknowlogy.com/downloads/timmccarthy/DDDTalkSDDNDG/DDD.zip" target="_blank"&gt;slides&lt;/a&gt; and here is my &lt;A href="http://blogs.interknowlogy.com/downloads/timmccarthy/DDDTalkSDDNDG/Code.zip" target="_blank"&gt;code&lt;/a&gt;.  As promised, here is a diagram of the latest DDD framework that I have developed:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;&lt;img height="748" alt="DomainObjectsClassDiagram" src="/downloads/timmccarthy/DDDTalkSDDNDG/DomainObjectsClassDiagram.jpg" width="1291" border="0" /&gt;&lt;img src ="http://blogs.interknowlogy.com/timmccarthy/aggbug/9351.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Tim McCarthy</dc:creator><title>Data types in .NET layered applications</title><link>http://blogs.interknowlogy.com/timmccarthy/archive/2006/08/13/3737.aspx</link><pubDate>Sun, 13 Aug 2006 19:32:00 GMT</pubDate><guid>http://blogs.interknowlogy.com/timmccarthy/archive/2006/08/13/3737.aspx</guid><description>&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="2"&gt;Recently I had a discussion with a developer at a client&amp;#8217;s office about data types being returned from web services (and data passing strategies in layered applications), and in defense of my arguments I did some research.  I ran across some interesting articles and they pointed out some stuff that I did not realize (or did not think about in certain contexts) about SOA and data types.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;?xml:namespace prefix ="" o ns ="" "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="2"&gt;In actuality, the same thing gets passed back every time from a web service, which is an XML document that is defined by a schema from the WSDL.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="2"&gt;I ran into a table (I took out the stuff which does not apply to us) which summarizes the data types and their pros/cons:&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;table class="MsoTableGrid" style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-border-alt: solid windowtext .5pt; mso-yfti-tbllook: 480; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-insideh: .5pt solid windowtext; mso-border-insidev: .5pt solid windowtext" cellspacing="0" cellpadding="0" border="1"&gt;
&lt;tbody&gt;
&lt;tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes"&gt;
&lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: windowtext 1pt solid; WIDTH: 110.7pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt" valign="top" width="148"&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="2"&gt;Abstraction&lt;/font&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #e0dfe3; WIDTH: 110.7pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" valign="top" width="148"&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="2"&gt;Contract standard&lt;/font&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #e0dfe3; WIDTH: 110.7pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" valign="top" width="148"&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="2"&gt;Advantages&lt;/font&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #e0dfe3; WIDTH: 110.7pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt" valign="top" width="148"&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="2"&gt;Disadvantages&lt;/font&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 1"&gt;
&lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: windowtext 1pt solid; WIDTH: 110.7pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" valign="top" width="148"&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="2"&gt;Text, JSON, binary&lt;/font&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #e0dfe3; WIDTH: 110.7pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" valign="top" width="148"&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="2"&gt;Informal, textual&lt;/font&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #e0dfe3; WIDTH: 110.7pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" valign="top" width="148"&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="2"&gt;Relatively efficient&lt;/font&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #e0dfe3; WIDTH: 110.7pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" valign="top" width="148"&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="2"&gt;Not self-describing, not ideally efficient&lt;/font&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 2"&gt;
&lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: windowtext 1pt solid; WIDTH: 110.7pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" valign="top" width="148"&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="2"&gt;Native objects&lt;/font&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #e0dfe3; WIDTH: 110.7pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" valign="top" width="148"&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="2"&gt;Class definition&lt;/font&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #e0dfe3; WIDTH: 110.7pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" valign="top" width="148"&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="2"&gt;Unified behavior and data, encapsulation, high-level abstraction, and composition&lt;/font&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #e0dfe3; WIDTH: 110.7pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" valign="top" width="148"&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="2"&gt;Requires conversion of most data into objects, which requires a mapping technique&lt;/font&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 3; mso-yfti-lastrow: yes"&gt;
&lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: windowtext 1pt solid; WIDTH: 110.7pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" valign="top" width="148"&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="2"&gt;XML&lt;/font&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #e0dfe3; WIDTH: 110.7pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" valign="top" width="148"&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="2"&gt;XML schemas (XSD), Relax NG, WSDL, and many others&lt;/font&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #e0dfe3; WIDTH: 110.7pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" valign="top" width="148"&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="2"&gt;Self-describing, rich schema description, and extensible without breaking backward compatibility&lt;/font&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: #e0dfe3; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: #e0dfe3; WIDTH: 110.7pt; PADDING-TOP: 0in; BORDER-BOTTOM: windowtext 1pt solid; BACKGROUND-COLOR: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt" valign="top" width="148"&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="2"&gt;Very size inefficient, no way to distribute behavior, and schema descriptions are limited even with XSD&lt;/font&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="2"&gt;In the case of a smart client, it will always be the XML type being passed from a web service to the smart client application.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;For the most part, I really like the pattern of the smart client talking to a generic service broker web service that accepts a variable number of arguments and returns a generic DataSet.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Then once the client gets the DataSet (deserialized of course), it can do whatever it wants with it.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;That contract should never be broken, at least at design time it will not.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;What a DataSet does is it gives you a common abstraction to all data, which gives you a single unified model to work with.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;That is very appealing for all of the reasons that we discussed earlier.&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="2"&gt;What could happen once the application receives the DataSet is that you may try converting the DataSet to some type of strongly-typed DataSet (based on a schema) or a class instance on the client at run time, and that is that part that could break.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;This is what I like about the DTO pattern, everything is strongly typed at design-time, and type-casting errors are caught by the compiler and not the run-time.&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="2"&gt;DataSets are nice in .NET consumers because the framework will automatically convert the XML from the web service into a DataSet (not just the data, but all of the DataSet functionality) &amp;#8220;automagically&amp;#8221; for you, whereas it will only convert a class entity into a dumb object (just with properties only).&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Now, you could modify the proxy to convert the XML from the web service to cast it to a local class instance (or better yet use a derivation of the Mapper or Assembler pattern), but then you would need the definition of the class to be referenced (either in a .cs file or in a referenced assembly) on the client, but with a DataSet this happens for free (you get both the data and the behavior).&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="2"&gt;One thing I also found out was that you can have a web service that has nullable data type arguments, meaning that you can actually change the contract of a web service without breaking an existing consumer of the service (although they will want to eventually upgrade).&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;In XSD terms, this means that all non-essential arguments can have their nillable attribute set to true (&lt;font face="Arial"&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;nillable=&amp;#8221;true&amp;#8221;&lt;/span&gt;).&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;font size="2"&gt;Anyways, I&amp;#8217;m glad we talked about it because it really got me thinking bout this stuff.&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;span style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;&lt;font face="Arial" size="2"&gt;By the way, all of the articles that I read in regard to this subject were in this month&amp;#8217;s edition of &lt;i style="mso-bidi-font-style: normal"&gt;The Architecture Journal &lt;/i&gt;(Issue 8), which you can get to at &lt;/font&gt;&lt;a href="http://www.architecturejournal.net/"&gt;&lt;font face="Arial" size="2"&gt;http://www.ArchitectureJournal.net&lt;/font&gt;&lt;/a&gt;&lt;font face="Arial" size="2"&gt;.&lt;span style="mso-spacerun: yes"&gt;  Luckily, &lt;/span&gt;I just happened to have a hard copy with me in my backpack while travelling back home, and this month&amp;#8217;s theme was Data by Design.&lt;/font&gt;&lt;/span&gt;&lt;img src ="http://blogs.interknowlogy.com/timmccarthy/aggbug/3737.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Tim McCarthy</dc:creator><title>The Layered Architecture Domain Model</title><link>http://blogs.interknowlogy.com/timmccarthy/archive/2005/06/02/173.aspx</link><pubDate>Thu, 02 Jun 2005 03:23:00 GMT</pubDate><guid>http://blogs.interknowlogy.com/timmccarthy/archive/2005/06/02/173.aspx</guid><description>&lt;P&gt;&lt;FONT face=Arial&gt;I've recently been working on a project at a client site where they are in the process re-building all of their applications from legacy systems onto the .NET platform.  Talk about a architect's/developer's dream!  &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Some of the things that we decided for the general architecture of these applications were:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;1.  W&lt;/FONT&gt;&lt;FONT face=Arial&gt;e were going to use a layered domain model for the overall object model type of all of the applications.  &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;2.  We decided that we were going to use Data Transfer Objects (DTO's) to pass the data around to the various layers.  According to Martin Fowler, a DTO is &amp;#8220;&lt;EM&gt;an object that carries data between processes in order to reduce the number of method calls&lt;/EM&gt;&amp;#8220;.  In our .NET implementation, the DTO's are just classes with properties and no methods associated with them.  They can be used by any layer in the application architecture, and thus get placed into a common assembly.  No DataSets or Readers being passed around, just classes.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;3.  We created a separate business services layer, as well as a separate data services layer.  Both layers use the DTO's.  The data services layer uses the Microsoft Data Access Application Block (DAAB) to access stored procedures in the database.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;Here is what the architecture looks like, from a component perspective:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.interknowlogy.com/images/blogs_interknowlogy_com/timmccarthy/27/t_Components.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;/FONT&gt; &lt;/P&gt;
&lt;P&gt;&lt;IMG title="Layered Component Architecture" src="/images/blogs_interknowlogy_com/timmccarthy/27/r_Components.jpg" align=middle border=0&gt; &lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;I am tired and need sleep...I will post more on this later.&lt;/FONT&gt;&lt;/P&gt;&lt;img src ="http://blogs.interknowlogy.com/timmccarthy/aggbug/173.aspx" width = "1" height = "1" /&gt;</description></item></channel></rss>