<?xml version="1.0" encoding="iso-8859-1"?><!-- generator="b2evolution/4.0.3" -->
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Architecture, Design &#38; Strategy - Author(s): Christiaan Baes (chrissie1)</title>
		<link>http://blogs.lessthandot.com/index.php/Architect/</link>
		<atom:link rel="self" type="application/rss+xml" href="http://blogs.lessthandot.com/index.php/Architect/?tempskin=_rss2" />
		<description></description>
		<language>en-GB</language>
		<docs>http://blogs.law.harvard.edu/tech/rss</docs>
		<admin:generatorAgent rdf:resource="http://b2evolution.net/?v=4.0.3"/>
		<ttl>60</ttl>
				<item>
			<title>You need to know a lot when you want to be a developer.</title>
			<link>http://blogs.lessthandot.com/index.php/Architect/HardwareInfrastructureDesign/you-need-to-know-a-lot-when-you-want-to</link>
			<pubDate>Fri, 30 Jul 2010 08:06:35 +0000</pubDate>			<dc:creator>Christiaan Baes (chrissie1)</dc:creator>
			<category domain="main">Hardware &amp; Infrastructure Design</category>			<guid isPermaLink="false">914@http://blogs.lessthandot.com/</guid>
						<description>&lt;p&gt;I was looking at the stack they used for the new channel9 website.&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;MVC 2.0, Unity (from P&amp;amp;P), NHibernate, Fluent NHibernate, Memcached, Enyim Managed Memcached driver, Azure &amp;#8211; Fabric, Storage, Diagnostics, SQL Azure, xUnit (testing only), Live ID, Spark View Engine, Akismet (spam filtering service), AntiXSS, Tinymce, jQuery, and Silverlight.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;You can watch the video &lt;a href=&quot;http://channel9.msdn.com/shows/Going+Deep/Mike-Sampson-Inside-Rev9/&quot;&gt;by Mike Sampson on how they built the new site&lt;/a&gt; if you want to know more.&lt;/p&gt;

&lt;p&gt;But have you counted the number of frameworks/technologies required for such a site? I was going to say simple site but I don&#039;t think that exists anymore. I count 16 (I didn&#039;t count Storage and diagnostics). And I&#039;m sure they forgot a whole bunch that you just take for granted.&lt;/p&gt;

&lt;p&gt;Then I started counting the stack I use at work. In no particular order.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;nHibernate&lt;/li&gt;
  &lt;li&gt;WPF&lt;/li&gt;
  &lt;li&gt;Winforms&lt;/li&gt;
  &lt;li&gt;Log4net&lt;/li&gt;
  &lt;li&gt;NUnit&lt;/li&gt;
  &lt;li&gt;Rhino mocks&lt;/li&gt;
  &lt;li&gt;SQL-server&lt;/li&gt;
  &lt;li&gt;StructureMap&lt;/li&gt;
  &lt;li&gt;Microsoft reporting&lt;/li&gt;
  &lt;li&gt;ITextsharp&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Seems a whole lot less than what you need for web development. But the problem remains the same. You have to know all those things well to make them work together well and you need to know the tools that you can use to make them work together well.&lt;/p&gt;

&lt;p&gt;Here are just a few of the tools I use to make all that work well. Again in no particular order.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;SSMS&lt;/li&gt;
  &lt;li&gt;Redgate toolbelt&lt;/li&gt;
  &lt;li&gt;NDepend&lt;/li&gt;
  &lt;li&gt;Visual Studio 2010&lt;/li&gt;
  &lt;li&gt;Ncover/DotCover&lt;/li&gt;
  &lt;li&gt;Resharper&lt;/li&gt;
  &lt;li&gt;Finalbuilder&lt;/li&gt;
  &lt;li&gt;An enormous amount of third party controls&lt;/li&gt;
  &lt;li&gt;NHProf&lt;/li&gt;
  &lt;li&gt;SQLCop ;-)&lt;/li&gt;
  &lt;li&gt;VisualSVN&lt;/li&gt;
  &lt;li&gt;VMWare&lt;/li&gt;
  &lt;li&gt;Windows&lt;/li&gt;
  &lt;li&gt;Oracle&lt;/li&gt;
  &lt;li&gt;dotTrace&lt;/li&gt;
  &lt;li&gt;Sharepoint&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All these tools and frameworks you have to know and know well. Some you will only use once in a while but you have to know they exist and you have to know how to use them. And lets not forget all those things you tried and rejected. I think those make an even longer list.&lt;/p&gt;

&lt;p&gt;I&#039;m sure you could spend days and weeks just getting to grips with NDepend but you just don&#039;t have the time. And by the time you know all the above it is surely outdated. &lt;/p&gt;

&lt;p&gt;And then you also have to know something about hardware. &lt;/p&gt;

&lt;p&gt;But does that mean that the life of a developer is hard and harder than most other professionals? No, it isn&#039;t. I do the developing thing part time and the other part of the job takes just as much effort and commitment to do right as the development side of things. It&#039;s all part of the job. But you could do what you do with a lot less effort and commitment and some people do. But that doesn&#039;t make you better or worse then anyone else just different. Different people have different priorities. &lt;/p&gt;

&lt;p&gt;But I can sure understand why people don&#039;t want to learn new things and just do things with what they have now. &lt;/p&gt;

&lt;p&gt;I&#039;m just in it because I like to do what I do. As soon as it stops being fun I will move on. But for the moment I still have lots to learn and I&#039;m not as young as I used to be ;-) so it takes a little longer.&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://blogs.lessthandot.com/index.php/Architect/HardwareInfrastructureDesign/you-need-to-know-a-lot-when-you-want-to&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://lessthandot.com/&quot;&gt;LessThanDot&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>I was looking at the stack they used for the new channel9 website.</p>

<blockquote><p>MVC 2.0, Unity (from P&amp;P), NHibernate, Fluent NHibernate, Memcached, Enyim Managed Memcached driver, Azure &#8211; Fabric, Storage, Diagnostics, SQL Azure, xUnit (testing only), Live ID, Spark View Engine, Akismet (spam filtering service), AntiXSS, Tinymce, jQuery, and Silverlight.</p></blockquote>

<p>You can watch the video <a href="http://channel9.msdn.com/shows/Going+Deep/Mike-Sampson-Inside-Rev9/">by Mike Sampson on how they built the new site</a> if you want to know more.</p>

<p>But have you counted the number of frameworks/technologies required for such a site? I was going to say simple site but I don't think that exists anymore. I count 16 (I didn't count Storage and diagnostics). And I'm sure they forgot a whole bunch that you just take for granted.</p>

<p>Then I started counting the stack I use at work. In no particular order.</p>

<ul>
  <li>nHibernate</li>
  <li>WPF</li>
  <li>Winforms</li>
  <li>Log4net</li>
  <li>NUnit</li>
  <li>Rhino mocks</li>
  <li>SQL-server</li>
  <li>StructureMap</li>
  <li>Microsoft reporting</li>
  <li>ITextsharp</li>
</ul>

<p>Seems a whole lot less than what you need for web development. But the problem remains the same. You have to know all those things well to make them work together well and you need to know the tools that you can use to make them work together well.</p>

<p>Here are just a few of the tools I use to make all that work well. Again in no particular order.</p>

<ul>
  <li>SSMS</li>
  <li>Redgate toolbelt</li>
  <li>NDepend</li>
  <li>Visual Studio 2010</li>
  <li>Ncover/DotCover</li>
  <li>Resharper</li>
  <li>Finalbuilder</li>
  <li>An enormous amount of third party controls</li>
  <li>NHProf</li>
  <li>SQLCop ;-)</li>
  <li>VisualSVN</li>
  <li>VMWare</li>
  <li>Windows</li>
  <li>Oracle</li>
  <li>dotTrace</li>
  <li>Sharepoint</li>
</ul>

<p>All these tools and frameworks you have to know and know well. Some you will only use once in a while but you have to know they exist and you have to know how to use them. And lets not forget all those things you tried and rejected. I think those make an even longer list.</p>

<p>I'm sure you could spend days and weeks just getting to grips with NDepend but you just don't have the time. And by the time you know all the above it is surely outdated. </p>

<p>And then you also have to know something about hardware. </p>

<p>But does that mean that the life of a developer is hard and harder than most other professionals? No, it isn't. I do the developing thing part time and the other part of the job takes just as much effort and commitment to do right as the development side of things. It's all part of the job. But you could do what you do with a lot less effort and commitment and some people do. But that doesn't make you better or worse then anyone else just different. Different people have different priorities. </p>

<p>But I can sure understand why people don't want to learn new things and just do things with what they have now. </p>

<p>I'm just in it because I like to do what I do. As soon as it stops being fun I will move on. But for the moment I still have lots to learn and I'm not as young as I used to be ;-) so it takes a little longer.</p><div class="item_footer"><p><small><a href="http://blogs.lessthandot.com/index.php/Architect/HardwareInfrastructureDesign/you-need-to-know-a-lot-when-you-want-to">Original post</a> blogged on <a href="http://lessthandot.com/">LessThanDot</a>.</small></p></div>]]></content:encoded>
								<comments>http://blogs.lessthandot.com/index.php/Architect/HardwareInfrastructureDesign/you-need-to-know-a-lot-when-you-want-to#comments</comments>
			<wfw:commentRss>http://blogs.lessthandot.com/index.php/Architect/?tempskin=_rss2&#38;disp=comments&#38;p=914</wfw:commentRss>
		</item>
				<item>
			<title>A good book and the observer pattern for VB.Net</title>
			<link>http://blogs.lessthandot.com/index.php/Architect/IntroductionArchitectureDesign/a-good-book-and-the-observer-pattern-for</link>
			<pubDate>Mon, 13 Apr 2009 11:40:50 +0000</pubDate>			<dc:creator>Christiaan Baes (chrissie1)</dc:creator>
			<category domain="main">Introduction to Architecture &amp; Design</category>			<guid isPermaLink="false">396@http://blogs.lessthandot.com/</guid>
						<description>&lt;p&gt;I am reading this very good book. It&#039;s called &lt;a href=&quot;http://www.amazon.com/First-Design-Patterns-Elisabeth-Freeman/dp/0596007124&quot;&gt;Head first Design Patterns by Eric Freeman &amp;amp; Elisabeth Freeman&lt;/a&gt;. It covers all the basic design patterns an OO-developer could ever use. Actualy, if you are doing OO programming you might see that you were already using some of these patterns but didn&#039;t know it. Alle the patterns are quite well explained in a simple matter. And we all know what Einstein said about explaining things simple. But for those of you who didn&#039;t.&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;&lt;a href=&quot;http://thinkexist.com/quotation/if_you_can-t_explain_it_simply-you_don-t/186838.html&quot;&gt;&amp;#8220;If you can&#039;t explain it simply, you don&#039;t understand it well enough&amp;#8221;&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;So clearly Eric and Elisabeth have grocked design patterns.&lt;/p&gt;

&lt;p&gt;But there is a little but for this book. All the code samples are explained with Java code as an example and in the beginning of the book they state that all examples will work just as well with C#. Which for the most part they do. &lt;/p&gt;

&lt;p&gt;But the &lt;a href=&quot;http://en.wikipedia.org/wiki/Observer_pattern&quot;&gt;Observer pattern&lt;/a&gt; in Java is always implemented with an abstract observable also called subject and an interface for the observer which holds the update method. &lt;/p&gt;

&lt;p&gt;I&#039;m not going to explain in detail what the observer pattern is. You can read more about that in wikipedia or elsewhere on the Google.&lt;/p&gt;

&lt;p&gt;What I am however goigng to show you is that in .Net and here VB.Net you would use events to do the observer observable thing in a much more effecient way.&lt;/p&gt;

&lt;p&gt;Let&#039;s say I have a class Observable that has a event called NotifyObservers and several classes Observer that hols a reference to Observable than I would have the same thing as the Observer pattern. At first sight it might look different because our Observable doesn&#039;t seem to have a reference to it&#039;s observers but this is taken care of behind the scenes. In C# the difference is a little smaller. So now some code.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;vbnet&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;vbnet&quot; id=&quot;cb84035&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Class&lt;/span&gt; Observable&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; Event Update&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt; DoSomething&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; RaiseEvent Update&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Class&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb72635&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;AS you can see this is a very simmple class with one public method and one public Event to which the observers can subscribe or handle the event. Now how do they subscribe to an event in VB.Net. That&#039;s easy.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;vbnet&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;vbnet&quot; id=&quot;cb17157&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Class&lt;/span&gt; Observer1&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Private&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;WithEvents&lt;/span&gt; _Observable &lt;span style=&quot;color: #0600FF;&quot;&gt;as&lt;/span&gt; Observable&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;New&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Byval&lt;/span&gt; Observable &lt;span style=&quot;color: #0600FF;&quot;&gt;as&lt;/span&gt; Observable&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; _Observable = Observable&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Private&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt; HandleUpdate&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Handles&lt;/span&gt; _Observable.&lt;span style=&quot;color: #000000;&quot;&gt;Update&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp;Console.&lt;span style=&quot;color: #000000;&quot;&gt;WriteLine&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;I did it&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Class&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb43141&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt; &lt;/p&gt;

&lt;p&gt;The WithEvents keyword here is very important since it makes sure we can handle events coming from the Observable Class. The Method HandleUpdate is decorated with the keywor Handles which means that if the Observable raises the event Update that the method HandleUpdate will take care of it.&lt;/p&gt;

&lt;p&gt;If we create a little tesenvironment like so.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;vbnet&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;vbnet&quot; id=&quot;cb90355&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Module&lt;/span&gt; Module1&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt; Main&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Dim&lt;/span&gt; _Observable &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;New&lt;/span&gt; Observable&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Dim&lt;/span&gt; _Observer1 &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;New&lt;/span&gt; Observer1&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;_Observable&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _Observable.&lt;span style=&quot;color: #000000;&quot;&gt;DoSomething&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.&lt;span style=&quot;color: #000000;&quot;&gt;ReadLine&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Module&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb77146&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This will just print &quot;I did it&quot; in the console.&lt;/p&gt;


&lt;p&gt;And we can create a second class that looks pretty much the same.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;vbnet&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;vbnet&quot; id=&quot;cb14784&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Class&lt;/span&gt; Observer2&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Private&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;WithEvents&lt;/span&gt; _Observable &lt;span style=&quot;color: #0600FF;&quot;&gt;as&lt;/span&gt; Observable&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;New&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Byval&lt;/span&gt; Observable &lt;span style=&quot;color: #0600FF;&quot;&gt;as&lt;/span&gt; Observable&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; _Observable = Observable&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Private&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt; HandleUpdate&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Handles&lt;/span&gt; _Observable.&lt;span style=&quot;color: #000000;&quot;&gt;Update&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp;Console.&lt;span style=&quot;color: #000000;&quot;&gt;WriteLine&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;I did it too&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Class&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb95937&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt; &lt;/p&gt;

&lt;p&gt;And adapt our test implementation.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;vbnet&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;vbnet&quot; id=&quot;cb94782&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Module&lt;/span&gt; Module1&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt; Main&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Dim&lt;/span&gt; _Observable &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;New&lt;/span&gt; Observable&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Dim&lt;/span&gt; _Observer1 &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;New&lt;/span&gt; Observer1&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;_Observable&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Dim&lt;/span&gt; _Observer2 &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;New&lt;/span&gt; Observer2&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;_Observable&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _Observable.&lt;span style=&quot;color: #000000;&quot;&gt;DoSomething&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.&lt;span style=&quot;color: #000000;&quot;&gt;ReadLine&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Module&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb90530&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now it just prints &quot;I did it&quot; followed by &quot;I did it too&quot;&lt;/p&gt;

&lt;p&gt;And all this by just calling _Observable.DoSomething and nothing else. Of course I could refactor this a bit, since I did it is the same in both classes.&lt;/p&gt;

&lt;p&gt;I could for instance just pass the string via the update event. For this we change our Observable Class to.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;vbnet&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;vbnet&quot; id=&quot;cb2889&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Class&lt;/span&gt; Observable&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; Event Update&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Byval&lt;/span&gt; Message &lt;span style=&quot;color: #0600FF;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt; DoSomething&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; RaiseEvent Update&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;I did it&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Class&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb82372&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This means that I of course have to update the Observers too.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;vbnet&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;vbnet&quot; id=&quot;cb78264&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Class&lt;/span&gt; Observer1&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Private&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;WithEvents&lt;/span&gt; _Observable &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; Observable&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;New&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;ByVal&lt;/span&gt; Observable &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; Observable&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _Observable = Observable&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Private&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt; HandleUpdate&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;ByVal&lt;/span&gt; Message &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Handles&lt;/span&gt; _Observable.&lt;span style=&quot;color: #000000;&quot;&gt;Update&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.&lt;span style=&quot;color: #000000;&quot;&gt;WriteLine&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;Message&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Class&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb73060&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;vbnet&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;vbnet&quot; id=&quot;cb63380&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Class&lt;/span&gt; Observer2&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Private&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;WithEvents&lt;/span&gt; _Observable &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; Observable&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;New&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;ByVal&lt;/span&gt; Observable &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; Observable&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _Observable = Observable&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Private&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt; HandleUpdate&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;ByVal&lt;/span&gt; Message &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Handles&lt;/span&gt; _Observable.&lt;span style=&quot;color: #000000;&quot;&gt;Update&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.&lt;span style=&quot;color: #000000;&quot;&gt;WriteLine&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;Message &amp;amp; &lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot; too&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Class&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb2827&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The result of our code is exactly the same as before. But see how the event now takes a parameter and how the HandleUpdate methods on the observers has to implement that parameter.&lt;/p&gt;

&lt;p&gt;As you have perhaps already seen the Observer pattern is widely used in .Net. And I think you can come up with plenty of usefull things for it too.&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://blogs.lessthandot.com/index.php/Architect/IntroductionArchitectureDesign/a-good-book-and-the-observer-pattern-for&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://lessthandot.com/&quot;&gt;LessThanDot&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>I am reading this very good book. It's called <a href="http://www.amazon.com/First-Design-Patterns-Elisabeth-Freeman/dp/0596007124">Head first Design Patterns by Eric Freeman &amp; Elisabeth Freeman</a>. It covers all the basic design patterns an OO-developer could ever use. Actualy, if you are doing OO programming you might see that you were already using some of these patterns but didn't know it. Alle the patterns are quite well explained in a simple matter. And we all know what Einstein said about explaining things simple. But for those of you who didn't.</p>

<blockquote><p><a href="http://thinkexist.com/quotation/if_you_can-t_explain_it_simply-you_don-t/186838.html">&#8220;If you can't explain it simply, you don't understand it well enough&#8221;</a></p></blockquote>

<p>So clearly Eric and Elisabeth have grocked design patterns.</p>

<p>But there is a little but for this book. All the code samples are explained with Java code as an example and in the beginning of the book they state that all examples will work just as well with C#. Which for the most part they do. </p>

<p>But the <a href="http://en.wikipedia.org/wiki/Observer_pattern">Observer pattern</a> in Java is always implemented with an abstract observable also called subject and an interface for the observer which holds the update method. </p>

<p>I'm not going to explain in detail what the observer pattern is. You can read more about that in wikipedia or elsewhere on the Google.</p>

<p>What I am however goigng to show you is that in .Net and here VB.Net you would use events to do the observer observable thing in a much more effecient way.</p>

<p>Let's say I have a class Observable that has a event called NotifyObservers and several classes Observer that hols a reference to Observable than I would have the same thing as the Observer pattern. At first sight it might look different because our Observable doesn't seem to have a reference to it's observers but this is taken care of behind the scenes. In C# the difference is a little smaller. So now some code.</p>

<div class="codebox"><div class="codeheader"><span>vbnet</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb21194'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb21194','cb54059'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="vbnet" id="cb21194" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1"><span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Class</span> Observable</li><li style="" class="li2"><span style="color: #0600FF;">Public</span> Event Update<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp;</li><li style="" class="li2"><span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Sub</span> DoSomething<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; RaiseEvent Update<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> </li><li style="" class="li2"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></li><li style="" class="li1"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Class</span></li></ol></div><div id="cb54059" style="display: none; color: red;"></div></div></div>

<p>AS you can see this is a very simmple class with one public method and one public Event to which the observers can subscribe or handle the event. Now how do they subscribe to an event in VB.Net. That's easy.</p>

<div class="codebox"><div class="codeheader"><span>vbnet</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb80784'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb80784','cb2632'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="vbnet" id="cb80784" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1"><span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Class</span> Observer1</li><li style="" class="li2"><span style="color: #0600FF;">Private</span> <span style="color: #0600FF;">WithEvents</span> _Observable <span style="color: #0600FF;">as</span> Observable</li><li style="" class="li1"><span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Sub</span> <span style="color: #0600FF;">New</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">Byval</span> Observable <span style="color: #0600FF;">as</span> Observable<span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; _Observable = Observable</li><li style="" class="li1"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1"><span style="color: #0600FF;">Private</span> <span style="color: #0600FF;">Sub</span> HandleUpdate<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #0600FF;">Handles</span> _Observable.<span style="color: #000000;">Update</span></li><li style="" class="li2">&nbsp; &nbsp;Console.<span style="color: #000000;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">&quot;I did it&quot;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Class</span></li></ol></div><div id="cb2632" style="display: none; color: red;"></div></div></div><p> </p>

<p>The WithEvents keyword here is very important since it makes sure we can handle events coming from the Observable Class. The Method HandleUpdate is decorated with the keywor Handles which means that if the Observable raises the event Update that the method HandleUpdate will take care of it.</p>

<p>If we create a little tesenvironment like so.</p>

<div class="codebox"><div class="codeheader"><span>vbnet</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb5548'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb5548','cb3315'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="vbnet" id="cb5548" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1"><span style="color: #0600FF;">Module</span> Module1</li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #0600FF;">Sub</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> _Observable <span style="color: #0600FF;">As</span> <span style="color: #0600FF;">New</span> Observable</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> _Observer1 <span style="color: #0600FF;">As</span> <span style="color: #0600FF;">New</span> Observer1<span style="color: #000000;">&#40;</span>_Observable<span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; _Observable.<span style="color: #000000;">DoSomething</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #000000;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></li><li style="" class="li1">&nbsp;</li><li style="" class="li2"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Module</span></li></ol></div><div id="cb3315" style="display: none; color: red;"></div></div></div>

<p>This will just print "I did it" in the console.</p>


<p>And we can create a second class that looks pretty much the same.</p>

<div class="codebox"><div class="codeheader"><span>vbnet</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb23779'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb23779','cb95075'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="vbnet" id="cb23779" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1"><span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Class</span> Observer2</li><li style="" class="li2"><span style="color: #0600FF;">Private</span> <span style="color: #0600FF;">WithEvents</span> _Observable <span style="color: #0600FF;">as</span> Observable</li><li style="" class="li1"><span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Sub</span> <span style="color: #0600FF;">New</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">Byval</span> Observable <span style="color: #0600FF;">as</span> Observable<span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; _Observable = Observable</li><li style="" class="li1"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1"><span style="color: #0600FF;">Private</span> <span style="color: #0600FF;">Sub</span> HandleUpdate<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #0600FF;">Handles</span> _Observable.<span style="color: #000000;">Update</span></li><li style="" class="li2">&nbsp; &nbsp;Console.<span style="color: #000000;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">&quot;I did it too&quot;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Class</span></li></ol></div><div id="cb95075" style="display: none; color: red;"></div></div></div><p> </p>

<p>And adapt our test implementation.</p>

<div class="codebox"><div class="codeheader"><span>vbnet</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb17922'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb17922','cb36560'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="vbnet" id="cb17922" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1"><span style="color: #0600FF;">Module</span> Module1</li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #0600FF;">Sub</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> _Observable <span style="color: #0600FF;">As</span> <span style="color: #0600FF;">New</span> Observable</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> _Observer1 <span style="color: #0600FF;">As</span> <span style="color: #0600FF;">New</span> Observer1<span style="color: #000000;">&#40;</span>_Observable<span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> _Observer2 <span style="color: #0600FF;">As</span> <span style="color: #0600FF;">New</span> Observer2<span style="color: #000000;">&#40;</span>_Observable<span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; _Observable.<span style="color: #000000;">DoSomething</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #000000;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Module</span></li></ol></div><div id="cb36560" style="display: none; color: red;"></div></div></div>

<p>Now it just prints "I did it" followed by "I did it too"</p>

<p>And all this by just calling _Observable.DoSomething and nothing else. Of course I could refactor this a bit, since I did it is the same in both classes.</p>

<p>I could for instance just pass the string via the update event. For this we change our Observable Class to.</p>

<div class="codebox"><div class="codeheader"><span>vbnet</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb27192'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb27192','cb87102'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="vbnet" id="cb27192" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1"><span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Class</span> Observable</li><li style="" class="li2"><span style="color: #0600FF;">Public</span> Event Update<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">Byval</span> Message <span style="color: #0600FF;">as</span> <span style="color: #0600FF;">String</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp;</li><li style="" class="li2"><span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Sub</span> DoSomething<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; RaiseEvent Update<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">&quot;I did it&quot;</span><span style="color: #000000;">&#41;</span> </li><li style="" class="li2"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></li><li style="" class="li1"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Class</span></li></ol></div><div id="cb87102" style="display: none; color: red;"></div></div></div>

<p>This means that I of course have to update the Observers too.</p>

<div class="codebox"><div class="codeheader"><span>vbnet</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb46295'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb46295','cb45990'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="vbnet" id="cb46295" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1"><span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Class</span> Observer1</li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #0600FF;">Private</span> <span style="color: #0600FF;">WithEvents</span> _Observable <span style="color: #0600FF;">As</span> Observable</li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Sub</span> <span style="color: #0600FF;">New</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">ByVal</span> Observable <span style="color: #0600FF;">As</span> Observable<span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; _Observable = Observable</li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #0600FF;">Private</span> <span style="color: #0600FF;">Sub</span> HandleUpdate<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">ByVal</span> Message <span style="color: #0600FF;">As</span> <span style="color: #0600FF;">String</span><span style="color: #000000;">&#41;</span> <span style="color: #0600FF;">Handles</span> _Observable.<span style="color: #000000;">Update</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #000000;">WriteLine</span><span style="color: #000000;">&#40;</span>Message<span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></li><li style="" class="li2"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Class</span></li></ol></div><div id="cb45990" style="display: none; color: red;"></div></div></div>

<div class="codebox"><div class="codeheader"><span>vbnet</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb17646'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb17646','cb30330'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="vbnet" id="cb17646" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1"><span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Class</span> Observer2</li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #0600FF;">Private</span> <span style="color: #0600FF;">WithEvents</span> _Observable <span style="color: #0600FF;">As</span> Observable</li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Sub</span> <span style="color: #0600FF;">New</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">ByVal</span> Observable <span style="color: #0600FF;">As</span> Observable<span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; _Observable = Observable</li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #0600FF;">Private</span> <span style="color: #0600FF;">Sub</span> HandleUpdate<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">ByVal</span> Message <span style="color: #0600FF;">As</span> <span style="color: #0600FF;">String</span><span style="color: #000000;">&#41;</span> <span style="color: #0600FF;">Handles</span> _Observable.<span style="color: #000000;">Update</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #000000;">WriteLine</span><span style="color: #000000;">&#40;</span>Message &amp; <span style="color: #0600FF;">&quot; too&quot;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></li><li style="" class="li2"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Class</span></li></ol></div><div id="cb30330" style="display: none; color: red;"></div></div></div>

<p>The result of our code is exactly the same as before. But see how the event now takes a parameter and how the HandleUpdate methods on the observers has to implement that parameter.</p>

<p>As you have perhaps already seen the Observer pattern is widely used in .Net. And I think you can come up with plenty of usefull things for it too.</p><div class="item_footer"><p><small><a href="http://blogs.lessthandot.com/index.php/Architect/IntroductionArchitectureDesign/a-good-book-and-the-observer-pattern-for">Original post</a> blogged on <a href="http://lessthandot.com/">LessThanDot</a>.</small></p></div>]]></content:encoded>
								<comments>http://blogs.lessthandot.com/index.php/Architect/IntroductionArchitectureDesign/a-good-book-and-the-observer-pattern-for#comments</comments>
			<wfw:commentRss>http://blogs.lessthandot.com/index.php/Architect/?tempskin=_rss2&#38;disp=comments&#38;p=396</wfw:commentRss>
		</item>
				<item>
			<title>Asking the right question</title>
			<link>http://blogs.lessthandot.com/index.php/Architect/DesigningSoftware/asking-the-right-question</link>
			<pubDate>Sat, 21 Mar 2009 07:15:27 +0000</pubDate>			<dc:creator>Christiaan Baes (chrissie1)</dc:creator>
			<category domain="main">Designing Software</category>
<category domain="alt">Introduction to Architecture &amp; Design</category>			<guid isPermaLink="false">368@http://blogs.lessthandot.com/</guid>
						<description>&lt;p&gt;A while ago (asked Sep 18 at 14:34) I asked &lt;a href=&quot;http://stackoverflow.com/questions/93091/why-cant-string-be-mutable-in-java-and-net&quot;&gt;a question&lt;/a&gt; on &lt;a href=&quot;http://stackoverflow.com&quot;&gt;StackOverflow&lt;/a&gt;. I&#039;m pretty sure I could have found the answer via Google myself but it is so much eaasier to ask someone else to do the work for me and perhaps come up with the better answer. &lt;/p&gt;

&lt;p&gt;The question was.&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;&lt;span class=&quot;MT_blue&quot;&gt;Why can&amp;#8217;t string be mutable in java and .net&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;

&lt;blockquote&gt;&lt;p&gt;&lt;span class=&quot;MT_green&quot;&gt;Why is it that they decided to make string immutable in Java and .NET (and some other languages)? Why didn&#039;t they make it mutable?&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;As we can see there seems to be some disagreement over the correct answer to that question.&lt;/p&gt;

&lt;p&gt;Some say that security is one of the reasons.&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;&lt;span class=&quot;MT_red&quot;&gt;First - security&lt;/span&gt; &lt;a href=&quot;http://www.javafaq.nu/java-article1060.html&quot;&gt;http://www.javafaq.nu/java-article1060.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;    The main reason why String made immutable was security. Look at this example: We have a file open method with login check. We pass a String to this method to process authentication which is necessary before the call will be passed to OS. If String was mutable it was possible somehow to modify its content after the authentication check before OS gets request from program then it is possible to request any file. So if you have a right to open text file in user directory but then on the fly when somehow you manage to change the file name you can request to open &quot;passwd&quot; file or any other. Then a file can be modified and it will be possible to login directly to OS.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;But then others come up saying that is completely wrong.&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;&lt;span class=&quot;MT_red&quot;&gt;You really have no business answering technical questions related to software development if you believe that immutability has anthing to do with security.&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;I am reminded of my highschool C++ teacher who instructed us that private members were for for the explicit purpose of securing &#039;secret&#039; data like passwords.&lt;/p&gt;

&lt;p&gt;Strings are simply read-only by the limitations of their implementation within the VM -- they aren&#039;t hackproof, encyrpted, or actively monitored against changes for security purposes.&lt;/p&gt;

&lt;p&gt;Quite simply, the immutablility of string stems from the tradeoffs made for sake of efficienty (string pooling) and thread saftey.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now as the asker of this question should I be confused? No, not really I should learn and draw my own conclussions. I can&#039;t really tell which of the answers is correct. I can only weigh the explanations given. And then decide which one is correct. It is even possible that both are correct. &lt;/p&gt;

&lt;p&gt;I might conclude that the one stating that it has nothing to do with security is wrong because he doesn&#039;t clearly say why.&lt;/p&gt;

&lt;p&gt;And another thing.&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;did have the same thought, but checked the orginal posters location and found that they are from Belgium. Given that this means they are not likely to be a native English speaker. Coupled with the fact that most natives have a loose grasp of the language, I decided to cut &lt;span class=&quot;MT_red&quot;&gt;her&lt;/span&gt; some slack.  &amp;#8211; belugabob (22 hours ago)&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;I might be from Belgium (who knows) but I&#039;m definetly not a girl. I like the way the commenter did his research but then he also has to realize that there&#039;s a difference of culture between us Belgians and the rest of the world.&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://blogs.lessthandot.com/index.php/Architect/DesigningSoftware/asking-the-right-question&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://lessthandot.com/&quot;&gt;LessThanDot&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>A while ago (asked Sep 18 at 14:34) I asked <a href="http://stackoverflow.com/questions/93091/why-cant-string-be-mutable-in-java-and-net">a question</a> on <a href="http://stackoverflow.com">StackOverflow</a>. I'm pretty sure I could have found the answer via Google myself but it is so much eaasier to ask someone else to do the work for me and perhaps come up with the better answer. </p>

<p>The question was.</p>

<blockquote><p><span class="MT_blue">Why can&#8217;t string be mutable in java and .net</span></p></blockquote>

<blockquote><p><span class="MT_green">Why is it that they decided to make string immutable in Java and .NET (and some other languages)? Why didn't they make it mutable?</span></p></blockquote>

<p>As we can see there seems to be some disagreement over the correct answer to that question.</p>

<p>Some say that security is one of the reasons.</p>

<blockquote><p><span class="MT_red">First - security</span> <a href="http://www.javafaq.nu/java-article1060.html">http://www.javafaq.nu/java-article1060.html</a></p>

<p>    The main reason why String made immutable was security. Look at this example: We have a file open method with login check. We pass a String to this method to process authentication which is necessary before the call will be passed to OS. If String was mutable it was possible somehow to modify its content after the authentication check before OS gets request from program then it is possible to request any file. So if you have a right to open text file in user directory but then on the fly when somehow you manage to change the file name you can request to open "passwd" file or any other. Then a file can be modified and it will be possible to login directly to OS.</p></blockquote>

<p>But then others come up saying that is completely wrong.</p>

<blockquote><p><span class="MT_red">You really have no business answering technical questions related to software development if you believe that immutability has anthing to do with security.</span></p>

<p>I am reminded of my highschool C++ teacher who instructed us that private members were for for the explicit purpose of securing 'secret' data like passwords.</p>

<p>Strings are simply read-only by the limitations of their implementation within the VM -- they aren't hackproof, encyrpted, or actively monitored against changes for security purposes.</p>

<p>Quite simply, the immutablility of string stems from the tradeoffs made for sake of efficienty (string pooling) and thread saftey.</p>
</blockquote>

<p>Now as the asker of this question should I be confused? No, not really I should learn and draw my own conclussions. I can't really tell which of the answers is correct. I can only weigh the explanations given. And then decide which one is correct. It is even possible that both are correct. </p>

<p>I might conclude that the one stating that it has nothing to do with security is wrong because he doesn't clearly say why.</p>

<p>And another thing.</p>

<blockquote><p>did have the same thought, but checked the orginal posters location and found that they are from Belgium. Given that this means they are not likely to be a native English speaker. Coupled with the fact that most natives have a loose grasp of the language, I decided to cut <span class="MT_red">her</span> some slack.  &#8211; belugabob (22 hours ago)</p></blockquote>

<p>I might be from Belgium (who knows) but I'm definetly not a girl. I like the way the commenter did his research but then he also has to realize that there's a difference of culture between us Belgians and the rest of the world.</p><div class="item_footer"><p><small><a href="http://blogs.lessthandot.com/index.php/Architect/DesigningSoftware/asking-the-right-question">Original post</a> blogged on <a href="http://lessthandot.com/">LessThanDot</a>.</small></p></div>]]></content:encoded>
								<comments>http://blogs.lessthandot.com/index.php/Architect/DesigningSoftware/asking-the-right-question#comments</comments>
			<wfw:commentRss>http://blogs.lessthandot.com/index.php/Architect/?tempskin=_rss2&#38;disp=comments&#38;p=368</wfw:commentRss>
		</item>
				<item>
			<title>Using the structuremap Automocker</title>
			<link>http://blogs.lessthandot.com/index.php/Architect/DesigningSoftware/using-the-structuremap-automocker</link>
			<pubDate>Wed, 04 Feb 2009 06:32:14 +0000</pubDate>			<dc:creator>Christiaan Baes (chrissie1)</dc:creator>
			<category domain="main">Designing Software</category>			<guid isPermaLink="false">325@http://blogs.lessthandot.com/</guid>
						<description>&lt;p&gt;I was not really convinced in the past that I should use the Structuremap Automocker for any of my tests. I don&#039;t like using the container in my tests it makes them way to dependent on something not really needed to run the test. Of course I test to see if the container is well configured and if the objects are created by the container when it is well configured (this has saved me several times before). I really only have myself to blame because I didn&#039;t really try it and only suspected what it was doing. &lt;/p&gt;

&lt;p&gt;Well apparently I was wrong, and lucky for me I read the right blogs. &lt;/p&gt;

&lt;p&gt;Today &lt;a href=&quot;http://www.lostechies.com/members/jflanagan/default.aspx&quot;&gt;Josh Flanagan&lt;/a&gt; posted about it on &lt;a href=&quot;http://www.lostechies.com/&quot;&gt;Los Techies&lt;/a&gt;, &lt;a href=&quot;http://www.lostechies.com/blogs/joshuaflanagan/archive/2009/02/03/auto-mocking-explained.aspx?CommentPosted=true#commentmessage&quot;&gt;Auto mocking Explained&lt;/a&gt;. Thank you Josh. Of course it is easier for him since he works with Jeremy.&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://blogs.lessthandot.com/index.php/Architect/DesigningSoftware/using-the-structuremap-automocker&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://lessthandot.com/&quot;&gt;LessThanDot&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>I was not really convinced in the past that I should use the Structuremap Automocker for any of my tests. I don't like using the container in my tests it makes them way to dependent on something not really needed to run the test. Of course I test to see if the container is well configured and if the objects are created by the container when it is well configured (this has saved me several times before). I really only have myself to blame because I didn't really try it and only suspected what it was doing. </p>

<p>Well apparently I was wrong, and lucky for me I read the right blogs. </p>

<p>Today <a href="http://www.lostechies.com/members/jflanagan/default.aspx">Josh Flanagan</a> posted about it on <a href="http://www.lostechies.com/">Los Techies</a>, <a href="http://www.lostechies.com/blogs/joshuaflanagan/archive/2009/02/03/auto-mocking-explained.aspx?CommentPosted=true#commentmessage">Auto mocking Explained</a>. Thank you Josh. Of course it is easier for him since he works with Jeremy.</p><div class="item_footer"><p><small><a href="http://blogs.lessthandot.com/index.php/Architect/DesigningSoftware/using-the-structuremap-automocker">Original post</a> blogged on <a href="http://lessthandot.com/">LessThanDot</a>.</small></p></div>]]></content:encoded>
								<comments>http://blogs.lessthandot.com/index.php/Architect/DesigningSoftware/using-the-structuremap-automocker#comments</comments>
			<wfw:commentRss>http://blogs.lessthandot.com/index.php/Architect/?tempskin=_rss2&#38;disp=comments&#38;p=325</wfw:commentRss>
		</item>
				<item>
			<title>Making the simplest of domainmodels can be harder than you think</title>
			<link>http://blogs.lessthandot.com/index.php/Architect/IntroductionArchitectureDesign/making-the-simplest-of-domainmodels-can</link>
			<pubDate>Mon, 02 Feb 2009 08:42:02 +0000</pubDate>			<dc:creator>Christiaan Baes (chrissie1)</dc:creator>
			<category domain="main">Introduction to Architecture &amp; Design</category>			<guid isPermaLink="false">321@http://blogs.lessthandot.com/</guid>
						<description>&lt;p&gt;Lets start with the requirements.&lt;/p&gt;

&lt;blockquote&gt;
&lt;ul&gt;
  &lt;li&gt;User enters data of Person&lt;/li&gt;
  &lt;li&gt;User is only allowed to enter LastName and FirstName.&lt;/li&gt;
  &lt;li&gt;User is only allowed 30 characters per field.&lt;/li&gt;
  &lt;li&gt;Fields are not allowed to be empty&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;Seems simple enough.&lt;/p&gt;

&lt;p&gt;Lets start by creating some unittests to verify the requirements.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;csharp&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;csharp&quot; id=&quot;cb18626&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;Test&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;void&lt;/span&gt; If_person_LastName_property_sets_and_returns_correct_value&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person person = &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Person&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; person.&lt;span style=&quot;color: #0000FF;&quot;&gt;LastName&lt;/span&gt; = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;Test&amp;quot;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Assert.&lt;span style=&quot;color: #0000FF;&quot;&gt;AreEqual&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;Test&amp;quot;&lt;/span&gt;, person.&lt;span style=&quot;color: #0000FF;&quot;&gt;LastName&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;Test&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;ExpectedException&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;ExceptionName = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;System.Exception&amp;quot;&lt;/span&gt;, ExpectedMessage = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;The LastName can not be more than 30 characters long&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;void&lt;/span&gt; If_person_LastName_property_cannot_be_more_than_30_characters&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person person = &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Person&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; person.&lt;span style=&quot;color: #0000FF;&quot;&gt;LastName&lt;/span&gt; = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;TestTestTestTestTestTestTestTest&amp;quot;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;Test&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;ExpectedException&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;ExceptionName = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;System.Exception&amp;quot;&lt;/span&gt;, ExpectedMessage = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;The LastName can not be empty&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;void&lt;/span&gt; If_person_LastName_property_cannot_be_empty&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person person = &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Person&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; person.&lt;span style=&quot;color: #0000FF;&quot;&gt;LastName&lt;/span&gt; = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;Test&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;ExpectedException&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;ExceptionName = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;System.Exception&amp;quot;&lt;/span&gt;, ExpectedMessage = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;The LastName can not be empty&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;void&lt;/span&gt; If_person_LastName_property_cannot_be_null&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person person = &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Person&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; person.&lt;span style=&quot;color: #0000FF;&quot;&gt;LastName&lt;/span&gt; = &lt;span style=&quot;color: #0600FF;&quot;&gt;null&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;Test&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;void&lt;/span&gt; If_person_FirstName_property_sets_and_returns_correct_value&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person person = &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Person&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; person.&lt;span style=&quot;color: #0000FF;&quot;&gt;FirstName&lt;/span&gt; = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;Test&amp;quot;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Assert.&lt;span style=&quot;color: #0000FF;&quot;&gt;AreEqual&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;Test&amp;quot;&lt;/span&gt;, person.&lt;span style=&quot;color: #0000FF;&quot;&gt;FirstName&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;Test&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;ExpectedException&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;ExceptionName = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;System.Exception&amp;quot;&lt;/span&gt;, ExpectedMessage = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;The FirstName can not be more than 30 characters long&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;void&lt;/span&gt; If_person_FirstName_property_cannot_be_more_than_30_characters&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person person = &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Person&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; person.&lt;span style=&quot;color: #0000FF;&quot;&gt;FirstName&lt;/span&gt; = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;TestTestTestTestTestTestTestTest&amp;quot;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;Test&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;ExpectedException&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;ExceptionName = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;System.Exception&amp;quot;&lt;/span&gt;, ExpectedMessage = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;The FirstName can not be empty&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;void&lt;/span&gt; If_person_FirstName_property_cannot_be_empty&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person person = &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Person&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; person.&lt;span style=&quot;color: #0000FF;&quot;&gt;FirstName&lt;/span&gt; = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;Test&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;ExpectedException&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;ExceptionName = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;System.Exception&amp;quot;&lt;/span&gt;, ExpectedMessage = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;The FirstName can not be empty&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;void&lt;/span&gt; If_person_FirstName_property_cannot_be_null&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person person = &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Person&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; person.&lt;span style=&quot;color: #0000FF;&quot;&gt;FirstName&lt;/span&gt; = &lt;span style=&quot;color: #0600FF;&quot;&gt;null&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb34803&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And hey presto we have a bunch of test that won&#039;t go anywhere ;-). So lets make them red shall we meaning we want the thing to at least compile.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;csharp&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;csharp&quot; id=&quot;cb73471&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;System&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;Collections&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;Generic&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;Linq&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;Text&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;namespace&lt;/span&gt; RaisingEvents.&lt;span style=&quot;color: #0000FF;&quot;&gt;DomainModel&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;class&lt;/span&gt; Person&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;string&lt;/span&gt; lastName;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;string&lt;/span&gt; firstName;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; Person&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;string&lt;/span&gt; LastName&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; get &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; set &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;string&lt;/span&gt; FirstName&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; get &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; set &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb8982&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Nice red all the way.&lt;/p&gt;

&lt;p&gt;Now lets skip a few (more than a few actually but I&#039;m not writing a book about TDD) steps and make them all green.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;csharp&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;csharp&quot; id=&quot;cb11950&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;System&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;Collections&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;Generic&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;Linq&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;Text&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;namespace&lt;/span&gt; RaisingEvents.&lt;span style=&quot;color: #0000FF;&quot;&gt;DomainModel&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;class&lt;/span&gt; Person&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;string&lt;/span&gt; lastName;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;string&lt;/span&gt; firstName;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; Person&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;int&lt;/span&gt; Id&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; get &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;return&lt;/span&gt; id; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; set &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt; id = value; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;string&lt;/span&gt; LastName&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; get &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;return&lt;/span&gt; lastName; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; set &lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;String&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;IsNullOrEmpty&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;value&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;throw&lt;/span&gt; &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Exception&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;The LastName can not be empty&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;value.&lt;span style=&quot;color: #0000FF;&quot;&gt;Length&lt;/span&gt; &amp;gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;30&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;throw&lt;/span&gt; &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Exception&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;The LastName can not be more than 30 characters long&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lastName = value; &lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;string&lt;/span&gt; FirstName&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; get &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;return&lt;/span&gt; firstName; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; set &lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;String&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;IsNullOrEmpty&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;value&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;throw&lt;/span&gt; &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Exception&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;The FirstName can not be empty&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;value.&lt;span style=&quot;color: #0000FF;&quot;&gt;Length&lt;/span&gt; &amp;gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;30&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;throw&lt;/span&gt; &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Exception&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;The FirstName can not be more than 30 characters long&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; firstName = value; &lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb88255&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Every test goes green. SO we are all happy and exited because we followed the requirements and our domain object is correct... or so we think.&lt;/p&gt;

&lt;p&gt;And we thought wrong, we didn&#039;t read the requirements correctly. Or... the above unittests don&#039;t reflet the requirements correctly. Why? I hear you think. Because we allowed invalid state to kreep into our little model. LastName nor FirstName should ever be empty, I repeat ever.&lt;/p&gt;

&lt;p&gt;Lets add this test&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;csharp&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;csharp&quot; id=&quot;cb4919&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;Test&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;void&lt;/span&gt; If_person_FirstName_property_cannot_be_null_when_LastName_is_filled&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person person = &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Person&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; person.&lt;span style=&quot;color: #0000FF;&quot;&gt;LastName&lt;/span&gt; = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;test&amp;quot;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Assert.&lt;span style=&quot;color: #0000FF;&quot;&gt;IsNotNull&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;person.&lt;span style=&quot;color: #0000FF;&quot;&gt;FirstName&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Assert.&lt;span style=&quot;color: #0000FF;&quot;&gt;Less&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt; person.&lt;span style=&quot;color: #0000FF;&quot;&gt;FirstName&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;Length&lt;/span&gt;,&lt;span style=&quot;color: #FF0000;&quot;&gt;30&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Assert.&lt;span style=&quot;color: #0000FF;&quot;&gt;AreNotEqual&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;, person.&lt;span style=&quot;color: #0000FF;&quot;&gt;FirstName&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;Test&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;void&lt;/span&gt; If_person_LastName_property_cannot_be_null_when_firstname_is_filled&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person person = &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Person&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; person.&lt;span style=&quot;color: #0000FF;&quot;&gt;FirstName&lt;/span&gt; = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;test&amp;quot;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Assert.&lt;span style=&quot;color: #0000FF;&quot;&gt;IsNotNull&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;person.&lt;span style=&quot;color: #0000FF;&quot;&gt;LastName&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Assert.&lt;span style=&quot;color: #0000FF;&quot;&gt;Less&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;person.&lt;span style=&quot;color: #0000FF;&quot;&gt;LastName&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;Length&lt;/span&gt;,&lt;span style=&quot;color: #FF0000;&quot;&gt;30&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Assert.&lt;span style=&quot;color: #0000FF;&quot;&gt;AreNotEqual&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;, person.&lt;span style=&quot;color: #0000FF;&quot;&gt;LastName&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb6732&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That test fails because I am able to set a LastName and not have any firstname. Ofcourse I could wait for the domainobject to be persisted and then find out it was wrong but then that would defeat the purpose of making a Domainmodel. The model should be able to retain a valid state at all times.&lt;/p&gt;

&lt;p&gt;So lets change our DomainModel to reflect the requirements a bit better.&lt;/p&gt;


&lt;p&gt;And for me that would be this.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;csharp&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;csharp&quot; id=&quot;cb78786&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;System&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;Collections&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;Generic&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;Linq&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;Text&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;namespace&lt;/span&gt; RaisingEvents.&lt;span style=&quot;color: #0000FF;&quot;&gt;DomainModel&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;class&lt;/span&gt; Person&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;string&lt;/span&gt; lastName;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;string&lt;/span&gt; firstName;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; Person&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;string&lt;/span&gt; LastName, &lt;span style=&quot;color: #FF0000;&quot;&gt;string&lt;/span&gt; FirstName&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;LastName&lt;/span&gt; = LastName;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;this&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;FirstName&lt;/span&gt; = FirstName;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;string&lt;/span&gt; LastName&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; get &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;return&lt;/span&gt; lastName; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; set &lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;String&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;IsNullOrEmpty&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;value&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;throw&lt;/span&gt; &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Exception&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;The LastName can not be empty&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;value.&lt;span style=&quot;color: #0000FF;&quot;&gt;Length&lt;/span&gt; &amp;gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;30&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;throw&lt;/span&gt; &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Exception&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;The LastName can not be more than 30 characters long&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lastName = value; &lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;string&lt;/span&gt; FirstName&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; get &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;return&lt;/span&gt; firstName; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; set &lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;String&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;IsNullOrEmpty&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;value&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;throw&lt;/span&gt; &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Exception&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;The FirstName can not be empty&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;value.&lt;span style=&quot;color: #0000FF;&quot;&gt;Length&lt;/span&gt; &amp;gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;30&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;throw&lt;/span&gt; &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Exception&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;The FirstName can not be more than 30 characters long&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; firstName = value; &lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb7809&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;No more default constructor.&lt;/p&gt;

&lt;p&gt;So that means none of my tests will run anymore.&lt;/p&gt;

&lt;p&gt;I have to change them to this.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;csharp&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;csharp&quot; id=&quot;cb89105&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;System&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;Collections&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;Generic&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;Linq&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;Text&lt;/span&gt;;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;using&lt;/span&gt; NUnit.&lt;span style=&quot;color: #0000FF;&quot;&gt;Framework&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;namespace&lt;/span&gt; RaisingEvents.&lt;span style=&quot;color: #0000FF;&quot;&gt;DomainModel&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;Tests&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;TestFixture&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;class&lt;/span&gt; TestPerson&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;Test&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;void&lt;/span&gt; If_person_LastName_property_sets_and_returns_correct_value&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person person = &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Person&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;LastName&amp;quot;&lt;/span&gt;,&lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;FirstName&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; person.&lt;span style=&quot;color: #0000FF;&quot;&gt;LastName&lt;/span&gt; = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;Test&amp;quot;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Assert.&lt;span style=&quot;color: #0000FF;&quot;&gt;AreEqual&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;Test&amp;quot;&lt;/span&gt;, person.&lt;span style=&quot;color: #0000FF;&quot;&gt;LastName&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;Test&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;ExpectedException&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;ExceptionName = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;System.Exception&amp;quot;&lt;/span&gt;, ExpectedMessage = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;The LastName can not be more than 30 characters long&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;void&lt;/span&gt; If_person_LastName_property_cannot_be_more_than_30_characters&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person person = &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Person&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;LastName&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;FirstName&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; person.&lt;span style=&quot;color: #0000FF;&quot;&gt;LastName&lt;/span&gt; = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;TestTestTestTestTestTestTestTest&amp;quot;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;Test&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;ExpectedException&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;ExceptionName = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;System.Exception&amp;quot;&lt;/span&gt;, ExpectedMessage = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;The LastName can not be empty&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;void&lt;/span&gt; If_person_LastName_property_cannot_be_empty&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person person = &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Person&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;LastName&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;FirstName&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; person.&lt;span style=&quot;color: #0000FF;&quot;&gt;LastName&lt;/span&gt; = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;Test&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;ExpectedException&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;ExceptionName = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;System.Exception&amp;quot;&lt;/span&gt;, ExpectedMessage = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;The LastName can not be empty&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;void&lt;/span&gt; If_person_LastName_property_cannot_be_null&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person person = &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Person&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;LastName&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;FirstName&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; person.&lt;span style=&quot;color: #0000FF;&quot;&gt;LastName&lt;/span&gt; = &lt;span style=&quot;color: #0600FF;&quot;&gt;null&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;Test&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;void&lt;/span&gt; If_person_FirstName_property_sets_and_returns_correct_value&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person person = &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Person&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;LastName&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;FirstName&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; person.&lt;span style=&quot;color: #0000FF;&quot;&gt;FirstName&lt;/span&gt; = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;Test&amp;quot;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Assert.&lt;span style=&quot;color: #0000FF;&quot;&gt;AreEqual&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;Test&amp;quot;&lt;/span&gt;, person.&lt;span style=&quot;color: #0000FF;&quot;&gt;FirstName&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;Test&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;ExpectedException&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;ExceptionName = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;System.Exception&amp;quot;&lt;/span&gt;, ExpectedMessage = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;The FirstName can not be more than 30 characters long&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;void&lt;/span&gt; If_person_FirstName_property_cannot_be_more_than_30_characters&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person person = &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Person&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;LastName&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;FirstName&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; person.&lt;span style=&quot;color: #0000FF;&quot;&gt;FirstName&lt;/span&gt; = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;TestTestTestTestTestTestTestTest&amp;quot;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;Test&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;ExpectedException&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;ExceptionName = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;System.Exception&amp;quot;&lt;/span&gt;, ExpectedMessage = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;The FirstName can not be empty&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;void&lt;/span&gt; If_person_FirstName_property_cannot_be_empty&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person person = &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Person&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;LastName&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;FirstName&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; person.&lt;span style=&quot;color: #0000FF;&quot;&gt;FirstName&lt;/span&gt; = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;Test&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;ExpectedException&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;ExceptionName = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;System.Exception&amp;quot;&lt;/span&gt;, ExpectedMessage = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;The FirstName can not be empty&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;void&lt;/span&gt; If_person_FirstName_property_cannot_be_null&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person person = &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Person&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;LastName&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;FirstName&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; person.&lt;span style=&quot;color: #0000FF;&quot;&gt;FirstName&lt;/span&gt; = &lt;span style=&quot;color: #0600FF;&quot;&gt;null&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;Test&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;void&lt;/span&gt; If_person_FirstName_property_cannot_be_null_when_LastName_is_filled&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person person = &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Person&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;LastName&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;FirstName&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; person.&lt;span style=&quot;color: #0000FF;&quot;&gt;LastName&lt;/span&gt; = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;test&amp;quot;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Assert.&lt;span style=&quot;color: #0000FF;&quot;&gt;IsNotNull&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;person.&lt;span style=&quot;color: #0000FF;&quot;&gt;FirstName&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Assert.&lt;span style=&quot;color: #0000FF;&quot;&gt;Less&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt; person.&lt;span style=&quot;color: #0000FF;&quot;&gt;FirstName&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;Length&lt;/span&gt;,&lt;span style=&quot;color: #FF0000;&quot;&gt;30&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Assert.&lt;span style=&quot;color: #0000FF;&quot;&gt;AreNotEqual&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;, person.&lt;span style=&quot;color: #0000FF;&quot;&gt;FirstName&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#91;&lt;/span&gt;Test&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;void&lt;/span&gt; If_person_LastName_property_cannot_be_null_when_firstname_is_filled&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person person = &lt;a href=&quot;http://www.google.com/search?q=new+msdn.microsoft.com&quot;&gt;&lt;span style=&quot;color: #008000;&quot;&gt;new&lt;/span&gt;&lt;/a&gt; Person&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;LastName&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;FirstName&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; person.&lt;span style=&quot;color: #0000FF;&quot;&gt;FirstName&lt;/span&gt; = &lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;test&amp;quot;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Assert.&lt;span style=&quot;color: #0000FF;&quot;&gt;IsNotNull&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;person.&lt;span style=&quot;color: #0000FF;&quot;&gt;LastName&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Assert.&lt;span style=&quot;color: #0000FF;&quot;&gt;Less&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;person.&lt;span style=&quot;color: #0000FF;&quot;&gt;LastName&lt;/span&gt;.&lt;span style=&quot;color: #0000FF;&quot;&gt;Length&lt;/span&gt;,&lt;span style=&quot;color: #FF0000;&quot;&gt;30&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Assert.&lt;span style=&quot;color: #0000FF;&quot;&gt;AreNotEqual&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;, person.&lt;span style=&quot;color: #0000FF;&quot;&gt;LastName&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb57050&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now I&#039;m more satisfied with my test meeting the requirements. &lt;/p&gt;

&lt;p&gt;So the lesson of the day. Always think carefuly and read carefuly what it says on the package.&lt;/p&gt;

&lt;p&gt;Is this the best and only way of doing things? No way. I&#039;m sure we can come up with beter ways. What if we need an empty constructor for serializing? Is this still POCO? No because of the lack of empty constructor. But sometimes we need to compromise a little to get work done or we use less rigid DTO objects in the rest of the application. I wasn&#039;t looking for a compromise. Just a way to meet the requirements.&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://blogs.lessthandot.com/index.php/Architect/IntroductionArchitectureDesign/making-the-simplest-of-domainmodels-can&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://lessthandot.com/&quot;&gt;LessThanDot&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>Lets start with the requirements.</p>

<blockquote>
<ul>
  <li>User enters data of Person</li>
  <li>User is only allowed to enter LastName and FirstName.</li>
  <li>User is only allowed 30 characters per field.</li>
  <li>Fields are not allowed to be empty</li>
</ul>
</blockquote>

<p>Seems simple enough.</p>

<p>Lets start by creating some unittests to verify the requirements.</p>

<div class="codebox"><div class="codeheader"><span>csharp</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb39500'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb39500','cb99395'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="csharp" id="cb39500" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1"><span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#93;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> If_person_LastName_property_sets_and_returns_correct_value<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Person person = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Person<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; person.<span style="color: #0000FF;">LastName</span> = <span style="color: #808080;">&quot;Test&quot;</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Assert.<span style="color: #0000FF;">AreEqual</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Test&quot;</span>, person.<span style="color: #0000FF;">LastName</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1"><span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#93;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>ExpectedException<span style="color: #000000;">&#40;</span>ExceptionName = <span style="color: #808080;">&quot;System.Exception&quot;</span>, ExpectedMessage = <span style="color: #808080;">&quot;The LastName can not be more than 30 characters long&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> If_person_LastName_property_cannot_be_more_than_30_characters<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Person person = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Person<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; person.<span style="color: #0000FF;">LastName</span> = <span style="color: #808080;">&quot;TestTestTestTestTestTestTestTest&quot;</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#93;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>ExpectedException<span style="color: #000000;">&#40;</span>ExceptionName = <span style="color: #808080;">&quot;System.Exception&quot;</span>, ExpectedMessage = <span style="color: #808080;">&quot;The LastName can not be empty&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> If_person_LastName_property_cannot_be_empty<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Person person = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Person<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; person.<span style="color: #0000FF;">LastName</span> = <span style="color: #808080;">&quot;&quot;</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#93;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>ExpectedException<span style="color: #000000;">&#40;</span>ExceptionName = <span style="color: #808080;">&quot;System.Exception&quot;</span>, ExpectedMessage = <span style="color: #808080;">&quot;The LastName can not be empty&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> If_person_LastName_property_cannot_be_null<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Person person = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Person<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; person.<span style="color: #0000FF;">LastName</span> = <span style="color: #0600FF;">null</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#93;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> If_person_FirstName_property_sets_and_returns_correct_value<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Person person = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Person<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; person.<span style="color: #0000FF;">FirstName</span> = <span style="color: #808080;">&quot;Test&quot;</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Assert.<span style="color: #0000FF;">AreEqual</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Test&quot;</span>, person.<span style="color: #0000FF;">FirstName</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#93;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>ExpectedException<span style="color: #000000;">&#40;</span>ExceptionName = <span style="color: #808080;">&quot;System.Exception&quot;</span>, ExpectedMessage = <span style="color: #808080;">&quot;The FirstName can not be more than 30 characters long&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> If_person_FirstName_property_cannot_be_more_than_30_characters<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Person person = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Person<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; person.<span style="color: #0000FF;">FirstName</span> = <span style="color: #808080;">&quot;TestTestTestTestTestTestTestTest&quot;</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#93;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>ExpectedException<span style="color: #000000;">&#40;</span>ExceptionName = <span style="color: #808080;">&quot;System.Exception&quot;</span>, ExpectedMessage = <span style="color: #808080;">&quot;The FirstName can not be empty&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> If_person_FirstName_property_cannot_be_empty<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Person person = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Person<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; person.<span style="color: #0000FF;">FirstName</span> = <span style="color: #808080;">&quot;&quot;</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1"><span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#93;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>ExpectedException<span style="color: #000000;">&#40;</span>ExceptionName = <span style="color: #808080;">&quot;System.Exception&quot;</span>, ExpectedMessage = <span style="color: #808080;">&quot;The FirstName can not be empty&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> If_person_FirstName_property_cannot_be_null<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Person person = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Person<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; person.<span style="color: #0000FF;">FirstName</span> = <span style="color: #0600FF;">null</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li></ol></div><div id="cb99395" style="display: none; color: red;"></div></div></div>

<p>And hey presto we have a bunch of test that won't go anywhere ;-). So lets make them red shall we meaning we want the thing to at least compile.</p>

<div class="codebox"><div class="codeheader"><span>csharp</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb7255'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb7255','cb90982'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="csharp" id="cb7255" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1"><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>;</li><li style="" class="li2"><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Collections</span>.<span style="color: #0000FF;">Generic</span>;</li><li style="" class="li1"><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Linq</span>;</li><li style="" class="li2"><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Text</span>;</li><li style="" class="li1">&nbsp;</li><li style="" class="li2"><span style="color: #0600FF;">namespace</span> RaisingEvents.<span style="color: #0000FF;">DomainModel</span></li><li style="" class="li1"><span style="color: #000000;">&#123;</span></li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> Person</li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">private</span> <span style="color: #FF0000;">string</span> lastName;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">private</span> <span style="color: #FF0000;">string</span> firstName;</li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> Person<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> </li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> LastName</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#125;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; set <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#125;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> FirstName</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#125;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; set <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#125;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li1"><span style="color: #000000;">&#125;</span></li></ol></div><div id="cb90982" style="display: none; color: red;"></div></div></div>

<p>Nice red all the way.</p>

<p>Now lets skip a few (more than a few actually but I'm not writing a book about TDD) steps and make them all green.</p>

<div class="codebox"><div class="codeheader"><span>csharp</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb48025'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb48025','cb82656'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="csharp" id="cb48025" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1"><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>;</li><li style="" class="li2"><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Collections</span>.<span style="color: #0000FF;">Generic</span>;</li><li style="" class="li1"><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Linq</span>;</li><li style="" class="li2"><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Text</span>;</li><li style="" class="li1">&nbsp;</li><li style="" class="li2"><span style="color: #0600FF;">namespace</span> RaisingEvents.<span style="color: #0000FF;">DomainModel</span></li><li style="" class="li1"><span style="color: #000000;">&#123;</span></li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> Person</li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">private</span> <span style="color: #FF0000;">string</span> lastName;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">private</span> <span style="color: #FF0000;">string</span> firstName;</li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> Person<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> </li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">int</span> Id</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get <span style="color: #000000;">&#123;</span> <span style="color: #0600FF;">return</span> id; <span style="color: #000000;">&#125;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; set <span style="color: #000000;">&#123;</span> id = value; <span style="color: #000000;">&#125;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> LastName</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get <span style="color: #000000;">&#123;</span> <span style="color: #0600FF;">return</span> lastName; <span style="color: #000000;">&#125;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; set </li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">String</span>.<span style="color: #0000FF;">IsNullOrEmpty</span><span style="color: #000000;">&#40;</span>value<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #0600FF;">throw</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Exception<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;The LastName can not be empty&quot;</span><span style="color: #000000;">&#41;</span>; <span style="color: #000000;">&#125;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>value.<span style="color: #0000FF;">Length</span> &gt; <span style="color: #FF0000;">30</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #0600FF;">throw</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Exception<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;The LastName can not be more than 30 characters long&quot;</span><span style="color: #000000;">&#41;</span>; <span style="color: #000000;">&#125;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lastName = value; </li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li1">&nbsp;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> FirstName</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get <span style="color: #000000;">&#123;</span> <span style="color: #0600FF;">return</span> firstName; <span style="color: #000000;">&#125;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; set </li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">String</span>.<span style="color: #0000FF;">IsNullOrEmpty</span><span style="color: #000000;">&#40;</span>value<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #0600FF;">throw</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Exception<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;The FirstName can not be empty&quot;</span><span style="color: #000000;">&#41;</span>; <span style="color: #000000;">&#125;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>value.<span style="color: #0000FF;">Length</span> &gt; <span style="color: #FF0000;">30</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #0600FF;">throw</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Exception<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;The FirstName can not be more than 30 characters long&quot;</span><span style="color: #000000;">&#41;</span>; <span style="color: #000000;">&#125;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; firstName = value; </li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li2"><span style="color: #000000;">&#125;</span></li></ol></div><div id="cb82656" style="display: none; color: red;"></div></div></div>

<p>Every test goes green. SO we are all happy and exited because we followed the requirements and our domain object is correct... or so we think.</p>

<p>And we thought wrong, we didn't read the requirements correctly. Or... the above unittests don't reflet the requirements correctly. Why? I hear you think. Because we allowed invalid state to kreep into our little model. LastName nor FirstName should ever be empty, I repeat ever.</p>

<p>Lets add this test</p>

<div class="codebox"><div class="codeheader"><span>csharp</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb43346'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb43346','cb83523'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="csharp" id="cb43346" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1"><span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#93;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> If_person_FirstName_property_cannot_be_null_when_LastName_is_filled<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Person person = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Person<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; person.<span style="color: #0000FF;">LastName</span> = <span style="color: #808080;">&quot;test&quot;</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Assert.<span style="color: #0000FF;">IsNotNull</span><span style="color: #000000;">&#40;</span>person.<span style="color: #0000FF;">FirstName</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Assert.<span style="color: #0000FF;">Less</span><span style="color: #000000;">&#40;</span> person.<span style="color: #0000FF;">FirstName</span>.<span style="color: #0000FF;">Length</span>,<span style="color: #FF0000;">30</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Assert.<span style="color: #0000FF;">AreNotEqual</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;&quot;</span>, person.<span style="color: #0000FF;">FirstName</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#93;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> If_person_LastName_property_cannot_be_null_when_firstname_is_filled<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Person person = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Person<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; person.<span style="color: #0000FF;">FirstName</span> = <span style="color: #808080;">&quot;test&quot;</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Assert.<span style="color: #0000FF;">IsNotNull</span><span style="color: #000000;">&#40;</span>person.<span style="color: #0000FF;">LastName</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Assert.<span style="color: #0000FF;">Less</span><span style="color: #000000;">&#40;</span>person.<span style="color: #0000FF;">LastName</span>.<span style="color: #0000FF;">Length</span>,<span style="color: #FF0000;">30</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Assert.<span style="color: #0000FF;">AreNotEqual</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;&quot;</span>, person.<span style="color: #0000FF;">LastName</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li></ol></div><div id="cb83523" style="display: none; color: red;"></div></div></div>

<p>That test fails because I am able to set a LastName and not have any firstname. Ofcourse I could wait for the domainobject to be persisted and then find out it was wrong but then that would defeat the purpose of making a Domainmodel. The model should be able to retain a valid state at all times.</p>

<p>So lets change our DomainModel to reflect the requirements a bit better.</p>


<p>And for me that would be this.</p>

<div class="codebox"><div class="codeheader"><span>csharp</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb74784'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb74784','cb77914'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="csharp" id="cb74784" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1"><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>;</li><li style="" class="li2"><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Collections</span>.<span style="color: #0000FF;">Generic</span>;</li><li style="" class="li1"><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Linq</span>;</li><li style="" class="li2"><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Text</span>;</li><li style="" class="li1">&nbsp;</li><li style="" class="li2"><span style="color: #0600FF;">namespace</span> RaisingEvents.<span style="color: #0000FF;">DomainModel</span></li><li style="" class="li1"><span style="color: #000000;">&#123;</span></li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> Person</li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">private</span> <span style="color: #FF0000;">string</span> lastName;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">private</span> <span style="color: #FF0000;">string</span> firstName;</li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> Person<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> LastName, <span style="color: #FF0000;">string</span> FirstName<span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">LastName</span> = LastName;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">FirstName</span> = FirstName;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> LastName</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get <span style="color: #000000;">&#123;</span> <span style="color: #0600FF;">return</span> lastName; <span style="color: #000000;">&#125;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; set </li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">String</span>.<span style="color: #0000FF;">IsNullOrEmpty</span><span style="color: #000000;">&#40;</span>value<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #0600FF;">throw</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Exception<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;The LastName can not be empty&quot;</span><span style="color: #000000;">&#41;</span>; <span style="color: #000000;">&#125;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>value.<span style="color: #0000FF;">Length</span> &gt; <span style="color: #FF0000;">30</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #0600FF;">throw</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Exception<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;The LastName can not be more than 30 characters long&quot;</span><span style="color: #000000;">&#41;</span>; <span style="color: #000000;">&#125;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lastName = value; </li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li1">&nbsp;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> FirstName</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get <span style="color: #000000;">&#123;</span> <span style="color: #0600FF;">return</span> firstName; <span style="color: #000000;">&#125;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; set </li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">String</span>.<span style="color: #0000FF;">IsNullOrEmpty</span><span style="color: #000000;">&#40;</span>value<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #0600FF;">throw</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Exception<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;The FirstName can not be empty&quot;</span><span style="color: #000000;">&#41;</span>; <span style="color: #000000;">&#125;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>value.<span style="color: #0000FF;">Length</span> &gt; <span style="color: #FF0000;">30</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #0600FF;">throw</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Exception<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;The FirstName can not be more than 30 characters long&quot;</span><span style="color: #000000;">&#41;</span>; <span style="color: #000000;">&#125;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; firstName = value; </li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li2"><span style="color: #000000;">&#125;</span></li></ol></div><div id="cb77914" style="display: none; color: red;"></div></div></div>

<p>No more default constructor.</p>

<p>So that means none of my tests will run anymore.</p>

<p>I have to change them to this.</p>

<div class="codebox"><div class="codeheader"><span>csharp</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb2168'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb2168','cb82105'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="csharp" id="cb2168" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1"><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>;</li><li style="" class="li2"><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Collections</span>.<span style="color: #0000FF;">Generic</span>;</li><li style="" class="li1"><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Linq</span>;</li><li style="" class="li2"><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Text</span>;</li><li style="" class="li1"><span style="color: #0600FF;">using</span> NUnit.<span style="color: #0000FF;">Framework</span>;</li><li style="" class="li2">&nbsp;</li><li style="" class="li1"><span style="color: #0600FF;">namespace</span> RaisingEvents.<span style="color: #0000FF;">DomainModel</span>.<span style="color: #0000FF;">Tests</span></li><li style="" class="li2"><span style="color: #000000;">&#123;</span></li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #000000;">&#91;</span>TestFixture<span style="color: #000000;">&#93;</span></li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> TestPerson</li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#93;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> If_person_LastName_property_sets_and_returns_correct_value<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Person person = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Person<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;LastName&quot;</span>,<span style="color: #808080;">&quot;FirstName&quot;</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; person.<span style="color: #0000FF;">LastName</span> = <span style="color: #808080;">&quot;Test&quot;</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Assert.<span style="color: #0000FF;">AreEqual</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Test&quot;</span>, person.<span style="color: #0000FF;">LastName</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li1">&nbsp;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#93;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>ExpectedException<span style="color: #000000;">&#40;</span>ExceptionName = <span style="color: #808080;">&quot;System.Exception&quot;</span>, ExpectedMessage = <span style="color: #808080;">&quot;The LastName can not be more than 30 characters long&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> If_person_LastName_property_cannot_be_more_than_30_characters<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Person person = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Person<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;LastName&quot;</span>, <span style="color: #808080;">&quot;FirstName&quot;</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; person.<span style="color: #0000FF;">LastName</span> = <span style="color: #808080;">&quot;TestTestTestTestTestTestTestTest&quot;</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li1">&nbsp;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#93;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>ExpectedException<span style="color: #000000;">&#40;</span>ExceptionName = <span style="color: #808080;">&quot;System.Exception&quot;</span>, ExpectedMessage = <span style="color: #808080;">&quot;The LastName can not be empty&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> If_person_LastName_property_cannot_be_empty<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Person person = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Person<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;LastName&quot;</span>, <span style="color: #808080;">&quot;FirstName&quot;</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; person.<span style="color: #0000FF;">LastName</span> = <span style="color: #808080;">&quot;&quot;</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li1">&nbsp;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#93;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>ExpectedException<span style="color: #000000;">&#40;</span>ExceptionName = <span style="color: #808080;">&quot;System.Exception&quot;</span>, ExpectedMessage = <span style="color: #808080;">&quot;The LastName can not be empty&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> If_person_LastName_property_cannot_be_null<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Person person = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Person<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;LastName&quot;</span>, <span style="color: #808080;">&quot;FirstName&quot;</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; person.<span style="color: #0000FF;">LastName</span> = <span style="color: #0600FF;">null</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li1">&nbsp;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#93;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> If_person_FirstName_property_sets_and_returns_correct_value<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Person person = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Person<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;LastName&quot;</span>, <span style="color: #808080;">&quot;FirstName&quot;</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; person.<span style="color: #0000FF;">FirstName</span> = <span style="color: #808080;">&quot;Test&quot;</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Assert.<span style="color: #0000FF;">AreEqual</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Test&quot;</span>, person.<span style="color: #0000FF;">FirstName</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li1">&nbsp;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#93;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>ExpectedException<span style="color: #000000;">&#40;</span>ExceptionName = <span style="color: #808080;">&quot;System.Exception&quot;</span>, ExpectedMessage = <span style="color: #808080;">&quot;The FirstName can not be more than 30 characters long&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> If_person_FirstName_property_cannot_be_more_than_30_characters<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Person person = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Person<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;LastName&quot;</span>, <span style="color: #808080;">&quot;FirstName&quot;</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; person.<span style="color: #0000FF;">FirstName</span> = <span style="color: #808080;">&quot;TestTestTestTestTestTestTestTest&quot;</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li1">&nbsp;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#93;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>ExpectedException<span style="color: #000000;">&#40;</span>ExceptionName = <span style="color: #808080;">&quot;System.Exception&quot;</span>, ExpectedMessage = <span style="color: #808080;">&quot;The FirstName can not be empty&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> If_person_FirstName_property_cannot_be_empty<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Person person = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Person<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;LastName&quot;</span>, <span style="color: #808080;">&quot;FirstName&quot;</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; person.<span style="color: #0000FF;">FirstName</span> = <span style="color: #808080;">&quot;&quot;</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li1">&nbsp;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#93;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>ExpectedException<span style="color: #000000;">&#40;</span>ExceptionName = <span style="color: #808080;">&quot;System.Exception&quot;</span>, ExpectedMessage = <span style="color: #808080;">&quot;The FirstName can not be empty&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> If_person_FirstName_property_cannot_be_null<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Person person = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Person<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;LastName&quot;</span>, <span style="color: #808080;">&quot;FirstName&quot;</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; person.<span style="color: #0000FF;">FirstName</span> = <span style="color: #0600FF;">null</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li1">&nbsp;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#93;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> If_person_FirstName_property_cannot_be_null_when_LastName_is_filled<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Person person = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Person<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;LastName&quot;</span>, <span style="color: #808080;">&quot;FirstName&quot;</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; person.<span style="color: #0000FF;">LastName</span> = <span style="color: #808080;">&quot;test&quot;</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Assert.<span style="color: #0000FF;">IsNotNull</span><span style="color: #000000;">&#40;</span>person.<span style="color: #0000FF;">FirstName</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Assert.<span style="color: #0000FF;">Less</span><span style="color: #000000;">&#40;</span> person.<span style="color: #0000FF;">FirstName</span>.<span style="color: #0000FF;">Length</span>,<span style="color: #FF0000;">30</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Assert.<span style="color: #0000FF;">AreNotEqual</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;&quot;</span>, person.<span style="color: #0000FF;">FirstName</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li1">&nbsp;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#93;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> If_person_LastName_property_cannot_be_null_when_firstname_is_filled<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Person person = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Person<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;LastName&quot;</span>, <span style="color: #808080;">&quot;FirstName&quot;</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; person.<span style="color: #0000FF;">FirstName</span> = <span style="color: #808080;">&quot;test&quot;</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Assert.<span style="color: #0000FF;">IsNotNull</span><span style="color: #000000;">&#40;</span>person.<span style="color: #0000FF;">LastName</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Assert.<span style="color: #0000FF;">Less</span><span style="color: #000000;">&#40;</span>person.<span style="color: #0000FF;">LastName</span>.<span style="color: #0000FF;">Length</span>,<span style="color: #FF0000;">30</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Assert.<span style="color: #0000FF;">AreNotEqual</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;&quot;</span>, person.<span style="color: #0000FF;">LastName</span><span style="color: #000000;">&#41;</span>;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #000000;">&#125;</span></li><li style="" class="li2"><span style="color: #000000;">&#125;</span></li></ol></div><div id="cb82105" style="display: none; color: red;"></div></div></div>

<p>Now I'm more satisfied with my test meeting the requirements. </p>

<p>So the lesson of the day. Always think carefuly and read carefuly what it says on the package.</p>

<p>Is this the best and only way of doing things? No way. I'm sure we can come up with beter ways. What if we need an empty constructor for serializing? Is this still POCO? No because of the lack of empty constructor. But sometimes we need to compromise a little to get work done or we use less rigid DTO objects in the rest of the application. I wasn't looking for a compromise. Just a way to meet the requirements.</p><div class="item_footer"><p><small><a href="http://blogs.lessthandot.com/index.php/Architect/IntroductionArchitectureDesign/making-the-simplest-of-domainmodels-can">Original post</a> blogged on <a href="http://lessthandot.com/">LessThanDot</a>.</small></p></div>]]></content:encoded>
								<comments>http://blogs.lessthandot.com/index.php/Architect/IntroductionArchitectureDesign/making-the-simplest-of-domainmodels-can#comments</comments>
			<wfw:commentRss>http://blogs.lessthandot.com/index.php/Architect/?tempskin=_rss2&#38;disp=comments&#38;p=321</wfw:commentRss>
		</item>
				<item>
			<title>automapping fluent nhibernate and VB.Net</title>
			<link>http://blogs.lessthandot.com/index.php/Architect/DesigningSoftware/automapping-fluent-nhibernate-and-vb-net</link>
			<pubDate>Mon, 12 Jan 2009 09:30:36 +0000</pubDate>			<dc:creator>Christiaan Baes (chrissie1)</dc:creator>
			<category domain="main">Designing Software</category>			<guid isPermaLink="false">290@http://blogs.lessthandot.com/</guid>
						<description>&lt;p&gt;I thought it was time to use fluent nhibernate just to keep up. Up untill now I still use the old atributes and nhibernate 1.2.1 because I see no reason to upgrade. It all just works and does what it is supposed to do. &lt;/p&gt;

&lt;p&gt;But I don&#039;t want to stand in the way of progress and I want to help the VB.Net community ahead. So that &lt;a href=&quot;http://codebetter.com/blogs/jeremy.miller/archive/2009/01/07/a-challenge-to-the-vb-net-community-at-large-on-oss.aspx&quot;&gt;Jeremy&lt;/a&gt; can feel a bit better about the VB.Net community ;-). &lt;/p&gt;

&lt;p&gt;First thing I did was checkout the trunk versions of &lt;a href=&quot;https://nhibernate.svn.sourceforge.net/svnroot/nhibernate/trunk/nhibernate&quot;&gt;nHibernate&lt;/a&gt; and &lt;a href=&quot;http://fluent-nhibernate.googlecode.com/svn/trunk&quot;&gt;fluentnhibernate&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Then I made a huge database with one table in it. I used SQL server 2005 64 bits (just in case Ted is reading this) for this. &lt;/p&gt;

&lt;p&gt;this is the one table magic.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;tsql&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;tsql&quot; id=&quot;cb65948&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color: #0000FF;&quot;&gt;USE&lt;/span&gt; &lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;fluentnhibernate&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000FF;&quot;&gt;GO&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #00AF00;&quot;&gt;/****** Object: &amp;nbsp;Table [dbo].[Person] &amp;nbsp; &amp;nbsp;Script Date: 01/12/2009 10:54:14 ******/&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000FF;&quot;&gt;SET&lt;/span&gt; &lt;span style=&quot;color: #0000FF;&quot;&gt;ANSI_NULLS&lt;/span&gt; &lt;span style=&quot;color: #0000FF;&quot;&gt;ON&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000FF;&quot;&gt;GO&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000FF;&quot;&gt;SET&lt;/span&gt; &lt;span style=&quot;color: #0000FF;&quot;&gt;QUOTED_IDENTIFIER&lt;/span&gt; &lt;span style=&quot;color: #0000FF;&quot;&gt;ON&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000FF;&quot;&gt;GO&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0000FF;&quot;&gt;CREATE&lt;/span&gt; &lt;span style=&quot;color: #0000FF;&quot;&gt;TABLE&lt;/span&gt; &lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;dbo&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;Person&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;Id&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000FF;&quot;&gt;uniqueidentifier&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt; NOT NULL &lt;span style=&quot;color: #0000FF;&quot;&gt;CONSTRAINT&lt;/span&gt; &lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;DF_Person_Id&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt; &amp;nbsp;&lt;span style=&quot;color: #0000FF;&quot;&gt;DEFAULT&lt;/span&gt; &lt;span style=&quot;color: #808080;&quot;&gt;&amp;#40;&lt;/span&gt;newid&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#41;&lt;/span&gt;,&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;LastName&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000FF;&quot;&gt;nvarchar&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000;&quot;&gt;50&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #0000FF;&quot;&gt;COLLATE&lt;/span&gt; SQL_Latin1_General_CP1_CI_AS NOT NULL,&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;FirstName&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000FF;&quot;&gt;nvarchar&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000;&quot;&gt;50&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #0000FF;&quot;&gt;COLLATE&lt;/span&gt; SQL_Latin1_General_CP1_CI_AS NOT NULL&lt;br /&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #0000FF;&quot;&gt;ON&lt;/span&gt; &lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000FF;&quot;&gt;PRIMARY&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb82844&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And I filled up the table with this.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;tsql&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;tsql&quot; id=&quot;cb32687&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color: #0000FF;&quot;&gt;INSERT&lt;/span&gt; &lt;span style=&quot;color: #0000FF;&quot;&gt;INTO&lt;/span&gt; &lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;fluentnhibernate&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;dbo&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;Person&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;LastName&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;,&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;FirstName&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0000FF;&quot;&gt;VALUES&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&#039;Baes&#039;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;,&lt;span style=&quot;color: #FF0000;&quot;&gt;&#039;Christiaan&#039;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&lt;span style=&quot;color: #0000FF;&quot;&gt;INSERT&lt;/span&gt; &lt;span style=&quot;color: #0000FF;&quot;&gt;INTO&lt;/span&gt; &lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;fluentnhibernate&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;dbo&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;Person&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;LastName&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;,&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;FirstName&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0000FF;&quot;&gt;VALUES&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;&#039;Gobo&#039;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;,&lt;span style=&quot;color: #FF0000;&quot;&gt;&#039;Denis&#039;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb67262&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So the corresponding model class should be simple enough too.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;vbnet&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;vbnet&quot; id=&quot;cb6447&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;Namespace Model&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Class&lt;/span&gt; Person&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Private&lt;/span&gt; _id &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; Guid&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Private&lt;/span&gt; _lastName &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;String&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Private&lt;/span&gt; _firstName &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;String&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;New&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _id = Guid.&lt;span style=&quot;color: #000000;&quot;&gt;NewGuid&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _lastName = &lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _firstName = &lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Overridable&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Property&lt;/span&gt; Id&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; Guid&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Get&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Return _id&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Get&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Set&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;ByVal&lt;/span&gt; value &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; Guid&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _id = value&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Set&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Property&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Overridable&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Property&lt;/span&gt; LastName&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;String&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Get&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Return _lastName&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Get&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Set&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;ByVal&lt;/span&gt; value &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _lastName = value&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Set&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Property&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Overridable&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Property&lt;/span&gt; FirstName&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;String&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Get&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Return _firstName&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Get&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Set&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;ByVal&lt;/span&gt; value &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _firstName = value&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Set&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Property&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Class&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; Namespace&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb87767&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;First of all I added the fluentnhibernate project to my new solution, quickly noticing that it was not wise to call my testproject fluentnhibernate and even quicker changing that to fluentnhibernatetest.&lt;/p&gt;

&lt;p&gt;I also added nhibernate to the solution.&lt;/p&gt;

&lt;p&gt;And I added them as a reference to the testproject.&lt;/p&gt;

&lt;p&gt;And then I did this.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;vbnet&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;vbnet&quot; id=&quot;cb14450&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Option&lt;/span&gt; Infer &lt;span style=&quot;color: #0600FF;&quot;&gt;On&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;Imports FluentNHibernate.&lt;span style=&quot;color: #000000;&quot;&gt;AutoMap&lt;/span&gt;&lt;br /&gt;Imports fluentnhibernatetest.&lt;span style=&quot;color: #000000;&quot;&gt;Model&lt;/span&gt;&lt;br /&gt;Imports FluentNHibernate&lt;br /&gt;&amp;nbsp;&lt;br /&gt;Namespace Dal&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Class&lt;/span&gt; nHibernateConfiguration&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; Shared SessionFactory &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; NHibernate.&lt;span style=&quot;color: #000000;&quot;&gt;ISessionFactory&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; Shared ConnectionString &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;String&lt;/span&gt; = &lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;Server=servername;Database=fluentnhibernate;Trusted_Connection=True;&amp;quot;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; Shared &lt;span style=&quot;color: #0600FF;&quot;&gt;Function&lt;/span&gt; confignhibernate&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; NHibernate.&lt;span style=&quot;color: #000000;&quot;&gt;ISessionFactory&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Dim&lt;/span&gt; properties = &lt;span style=&quot;color: #0600FF;&quot;&gt;New&lt;/span&gt; Dictionary&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;Of &lt;span style=&quot;color: #0600FF;&quot;&gt;String&lt;/span&gt;, &lt;span style=&quot;color: #0600FF;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; properties.&lt;span style=&quot;color: #000000;&quot;&gt;Add&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;connection.connection_string&amp;quot;&lt;/span&gt;, ConnectionString&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; properties.&lt;span style=&quot;color: #000000;&quot;&gt;Add&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;connection.provider&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;NHibernate.Connection.DriverConnectionProvider&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; properties.&lt;span style=&quot;color: #000000;&quot;&gt;Add&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;dialect&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;NHibernate.Dialect.MsSql2005Dialect&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; properties.&lt;span style=&quot;color: #000000;&quot;&gt;Add&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;connection.driver_class&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;NHibernate.Driver.SqlClientDriver&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; properties.&lt;span style=&quot;color: #000000;&quot;&gt;Add&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;show_sql&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;true&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; properties.&lt;span style=&quot;color: #000000;&quot;&gt;Add&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;proxyfactory.factory_class&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Dim&lt;/span&gt; autoMappings = AutoPersistenceModel _&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;span style=&quot;color: #000000;&quot;&gt;MapEntitiesFromAssemblyOf&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;Of Person&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; _&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;span style=&quot;color: #000000;&quot;&gt;Where&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Function&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;t&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; t.&lt;span style=&quot;color: #000000;&quot;&gt;Namespace&lt;/span&gt; = &lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;fluentnhibernatetest.Model&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SessionFactory = &lt;span style=&quot;color: #0600FF;&quot;&gt;New&lt;/span&gt; NHibernate.&lt;span style=&quot;color: #000000;&quot;&gt;Cfg&lt;/span&gt;.&lt;span style=&quot;color: #000000;&quot;&gt;Configuration&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; _&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;span style=&quot;color: #000000;&quot;&gt;AddProperties&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;properties&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; _&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;span style=&quot;color: #000000;&quot;&gt;AddAutoMappings&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;autoMappings&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; _&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;span style=&quot;color: #000000;&quot;&gt;BuildSessionFactory&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Return SessionFactory&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Function&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Class&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; Namespace&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb10638&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;which meant I also had to import and reference the NHibernate.ByteCode.Linfu project/assembly. Cant&#039;t remember ever needing that.&lt;/p&gt;

&lt;p&gt;And of course I also neede something to run this and see if it worked. Of course I could have created a testproject but what&#039;s the fun in that.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;vbnet&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;vbnet&quot; id=&quot;cb28282&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Option&lt;/span&gt; Infer &lt;span style=&quot;color: #0600FF;&quot;&gt;On&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;Imports fluentnhibernatetest.&lt;span style=&quot;color: #000000;&quot;&gt;Model&lt;/span&gt;&lt;br /&gt;Imports NHibernate&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Module&lt;/span&gt; Module1&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt; Main&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Try&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Dim&lt;/span&gt; sessionfactory = Dal.&lt;span style=&quot;color: #000000;&quot;&gt;nHibernateConfiguration&lt;/span&gt;.&lt;span style=&quot;color: #000000;&quot;&gt;confignhibernate&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Dim&lt;/span&gt; session &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; ISession = sessionfactory.&lt;span style=&quot;color: #000000;&quot;&gt;OpenSession&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Dim&lt;/span&gt; _ReturnList = session.&lt;span style=&quot;color: #000000;&quot;&gt;CreateCriteria&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;GetType&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;Model.&lt;span style=&quot;color: #000000;&quot;&gt;Person&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&quot;color: #000000;&quot;&gt;List&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;Of Model.&lt;span style=&quot;color: #000000;&quot;&gt;Person&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;For&lt;/span&gt; Each Person In _ReturnList&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.&lt;span style=&quot;color: #000000;&quot;&gt;WriteLine&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;Person.&lt;span style=&quot;color: #000000;&quot;&gt;Id&lt;/span&gt;.&lt;span style=&quot;color: #000000;&quot;&gt;ToString&lt;/span&gt; &amp;amp; &lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt; &amp;amp; Person.&lt;span style=&quot;color: #000000;&quot;&gt;LastName&lt;/span&gt; &amp;amp; &lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt; &amp;amp; Person.&lt;span style=&quot;color: #000000;&quot;&gt;FirstName&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Next&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Catch ex &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; Exception&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.&lt;span style=&quot;color: #000000;&quot;&gt;WriteLine&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;ex.&lt;span style=&quot;color: #000000;&quot;&gt;Message&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.&lt;span style=&quot;color: #000000;&quot;&gt;WriteLine&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;ex.&lt;span style=&quot;color: #000000;&quot;&gt;StackTrace&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; Try&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.&lt;span style=&quot;color: #000000;&quot;&gt;ReadLine&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Module&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb15310&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;With this as the result of all our hard labor.&lt;/p&gt;

&lt;div class=&quot;image_block&quot;&gt;&lt;img src=&quot;http://blogs.lessthandot.com/media/blogs/Architect/fluentnhibernateresult.jpg&quot; alt=&quot;&quot; title=&quot;&quot; width=&quot;668&quot; height=&quot;335&quot; /&gt;&lt;/div&gt;&lt;p&gt; &lt;/p&gt;

&lt;p&gt;Not that difficult ;-). &lt;/p&gt;

&lt;p&gt;I will do a more elaborate test later on.&lt;/p&gt;

&lt;p&gt;Once again thanks to the guys that sacrificied their time and energy in making this happen.&lt;/p&gt;

&lt;p&gt;you can also find more examples in C# &lt;a href=&quot;http://blog.jagregory.com/2009/01/11/fluent-nhibernate-auto-mapping-entity-conventions/&quot;&gt;here&lt;/a&gt; by &lt;a href=&quot;http://blog.jagregory.com/&quot;&gt;James Gregory&lt;/a&gt;.&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://blogs.lessthandot.com/index.php/Architect/DesigningSoftware/automapping-fluent-nhibernate-and-vb-net&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://lessthandot.com/&quot;&gt;LessThanDot&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>I thought it was time to use fluent nhibernate just to keep up. Up untill now I still use the old atributes and nhibernate 1.2.1 because I see no reason to upgrade. It all just works and does what it is supposed to do. </p>

<p>But I don't want to stand in the way of progress and I want to help the VB.Net community ahead. So that <a href="http://codebetter.com/blogs/jeremy.miller/archive/2009/01/07/a-challenge-to-the-vb-net-community-at-large-on-oss.aspx">Jeremy</a> can feel a bit better about the VB.Net community ;-). </p>

<p>First thing I did was checkout the trunk versions of <a href="https://nhibernate.svn.sourceforge.net/svnroot/nhibernate/trunk/nhibernate">nHibernate</a> and <a href="http://fluent-nhibernate.googlecode.com/svn/trunk">fluentnhibernate</a> </p>

<p>Then I made a huge database with one table in it. I used SQL server 2005 64 bits (just in case Ted is reading this) for this. </p>

<p>this is the one table magic.</p>

<div class="codebox"><div class="codeheader"><span>tsql</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb43943'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb43943','cb28788'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="tsql" id="cb43943" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1"><span style="color: #0000FF;">USE</span> <span style="color: #808080;">&#91;</span>fluentnhibernate<span style="color: #808080;">&#93;</span></li><li style="" class="li2"><span style="color: #0000FF;">GO</span></li><li style="" class="li1"><span style="color: #00AF00;">/****** Object: &nbsp;Table [dbo].[Person] &nbsp; &nbsp;Script Date: 01/12/2009 10:54:14 ******/</span></li><li style="" class="li2"><span style="color: #0000FF;">SET</span> <span style="color: #0000FF;">ANSI_NULLS</span> <span style="color: #0000FF;">ON</span></li><li style="" class="li1"><span style="color: #0000FF;">GO</span></li><li style="" class="li2"><span style="color: #0000FF;">SET</span> <span style="color: #0000FF;">QUOTED_IDENTIFIER</span> <span style="color: #0000FF;">ON</span></li><li style="" class="li1"><span style="color: #0000FF;">GO</span></li><li style="" class="li2"><span style="color: #0000FF;">CREATE</span> <span style="color: #0000FF;">TABLE</span> <span style="color: #808080;">&#91;</span>dbo<span style="color: #808080;">&#93;</span>.<span style="color: #808080;">&#91;</span>Person<span style="color: #808080;">&#93;</span><span style="color: #808080;">&#40;</span></li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #808080;">&#91;</span>Id<span style="color: #808080;">&#93;</span> <span style="color: #808080;">&#91;</span><span style="color: #0000FF;">uniqueidentifier</span><span style="color: #808080;">&#93;</span> NOT NULL <span style="color: #0000FF;">CONSTRAINT</span> <span style="color: #808080;">&#91;</span>DF_Person_Id<span style="color: #808080;">&#93;</span> &nbsp;<span style="color: #0000FF;">DEFAULT</span> <span style="color: #808080;">&#40;</span>newid<span style="color: #808080;">&#40;</span><span style="color: #808080;">&#41;</span><span style="color: #808080;">&#41;</span>,</li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #808080;">&#91;</span>LastName<span style="color: #808080;">&#93;</span> <span style="color: #808080;">&#91;</span><span style="color: #0000FF;">nvarchar</span><span style="color: #808080;">&#93;</span><span style="color: #808080;">&#40;</span><span style="color: #000;">50</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">COLLATE</span> SQL_Latin1_General_CP1_CI_AS NOT NULL,</li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #808080;">&#91;</span>FirstName<span style="color: #808080;">&#93;</span> <span style="color: #808080;">&#91;</span><span style="color: #0000FF;">nvarchar</span><span style="color: #808080;">&#93;</span><span style="color: #808080;">&#40;</span><span style="color: #000;">50</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">COLLATE</span> SQL_Latin1_General_CP1_CI_AS NOT NULL</li><li style="" class="li2"><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">ON</span> <span style="color: #808080;">&#91;</span><span style="color: #0000FF;">PRIMARY</span><span style="color: #808080;">&#93;</span></li></ol></div><div id="cb28788" style="display: none; color: red;"></div></div></div>

<p>And I filled up the table with this.</p>

<div class="codebox"><div class="codeheader"><span>tsql</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb32230'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb32230','cb61719'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="tsql" id="cb32230" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1"><span style="color: #0000FF;">INSERT</span> <span style="color: #0000FF;">INTO</span> <span style="color: #808080;">&#91;</span>fluentnhibernate<span style="color: #808080;">&#93;</span>.<span style="color: #808080;">&#91;</span>dbo<span style="color: #808080;">&#93;</span>.<span style="color: #808080;">&#91;</span>Person<span style="color: #808080;">&#93;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080;">&#40;</span><span style="color: #808080;">&#91;</span>LastName<span style="color: #808080;">&#93;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;,<span style="color: #808080;">&#91;</span>FirstName<span style="color: #808080;">&#93;</span><span style="color: #808080;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp;<span style="color: #0000FF;">VALUES</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080;">&#40;</span><span style="color: #FF0000;">'Baes'</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;,<span style="color: #FF0000;">'Christiaan'</span><span style="color: #808080;">&#41;</span></li><li style="" class="li1">&nbsp;</li><li style="" class="li2"><span style="color: #0000FF;">INSERT</span> <span style="color: #0000FF;">INTO</span> <span style="color: #808080;">&#91;</span>fluentnhibernate<span style="color: #808080;">&#93;</span>.<span style="color: #808080;">&#91;</span>dbo<span style="color: #808080;">&#93;</span>.<span style="color: #808080;">&#91;</span>Person<span style="color: #808080;">&#93;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080;">&#40;</span><span style="color: #808080;">&#91;</span>LastName<span style="color: #808080;">&#93;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;,<span style="color: #808080;">&#91;</span>FirstName<span style="color: #808080;">&#93;</span><span style="color: #808080;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp;<span style="color: #0000FF;">VALUES</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #808080;">&#40;</span><span style="color: #FF0000;">'Gobo'</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;,<span style="color: #FF0000;">'Denis'</span><span style="color: #808080;">&#41;</span></li></ol></div><div id="cb61719" style="display: none; color: red;"></div></div></div>

<p>So the corresponding model class should be simple enough too.</p>

<div class="codebox"><div class="codeheader"><span>vbnet</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb11240'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb11240','cb20654'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="vbnet" id="cb11240" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1">Namespace Model</li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Class</span> Person</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Private</span> _id <span style="color: #0600FF;">As</span> Guid</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Private</span> _lastName <span style="color: #0600FF;">As</span> <span style="color: #0600FF;">String</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Private</span> _firstName <span style="color: #0600FF;">As</span> <span style="color: #0600FF;">String</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Sub</span> <span style="color: #0600FF;">New</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _id = Guid.<span style="color: #000000;">NewGuid</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _lastName = <span style="color: #0600FF;">&quot;&quot;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _firstName = <span style="color: #0600FF;">&quot;&quot;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Overridable</span> <span style="color: #0600FF;">Property</span> Id<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #0600FF;">As</span> Guid</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Get</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return _id</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Get</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Set</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">ByVal</span> value <span style="color: #0600FF;">As</span> Guid<span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _id = value</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Set</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Property</span></li><li style="" class="li1">&nbsp;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Overridable</span> <span style="color: #0600FF;">Property</span> LastName<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #0600FF;">As</span> <span style="color: #0600FF;">String</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Get</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return _lastName</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Get</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Set</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">ByVal</span> value <span style="color: #0600FF;">As</span> <span style="color: #0600FF;">String</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _lastName = value</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Set</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Property</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Overridable</span> <span style="color: #0600FF;">Property</span> FirstName<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #0600FF;">As</span> <span style="color: #0600FF;">String</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Get</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return _firstName</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Get</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Set</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">ByVal</span> value <span style="color: #0600FF;">As</span> <span style="color: #0600FF;">String</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _firstName = value</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Set</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Property</span></li><li style="" class="li1">&nbsp;</li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Class</span></li><li style="" class="li1"><span style="color: #0600FF;">End</span> Namespace</li></ol></div><div id="cb20654" style="display: none; color: red;"></div></div></div>

<p>First of all I added the fluentnhibernate project to my new solution, quickly noticing that it was not wise to call my testproject fluentnhibernate and even quicker changing that to fluentnhibernatetest.</p>

<p>I also added nhibernate to the solution.</p>

<p>And I added them as a reference to the testproject.</p>

<p>And then I did this.</p>

<div class="codebox"><div class="codeheader"><span>vbnet</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb78711'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb78711','cb72981'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="vbnet" id="cb78711" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1"><span style="color: #0600FF;">Option</span> Infer <span style="color: #0600FF;">On</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1">Imports FluentNHibernate.<span style="color: #000000;">AutoMap</span></li><li style="" class="li2">Imports fluentnhibernatetest.<span style="color: #000000;">Model</span></li><li style="" class="li1">Imports FluentNHibernate</li><li style="" class="li2">&nbsp;</li><li style="" class="li1">Namespace Dal</li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Class</span> nHibernateConfiguration</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Public</span> Shared SessionFactory <span style="color: #0600FF;">As</span> NHibernate.<span style="color: #000000;">ISessionFactory</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Public</span> Shared ConnectionString <span style="color: #0600FF;">As</span> <span style="color: #0600FF;">String</span> = <span style="color: #0600FF;">&quot;Server=servername;Database=fluentnhibernate;Trusted_Connection=True;&quot;</span></li><li style="" class="li1">&nbsp;</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Public</span> Shared <span style="color: #0600FF;">Function</span> confignhibernate<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #0600FF;">As</span> NHibernate.<span style="color: #000000;">ISessionFactory</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> properties = <span style="color: #0600FF;">New</span> Dictionary<span style="color: #000000;">&#40;</span>Of <span style="color: #0600FF;">String</span>, <span style="color: #0600FF;">String</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; properties.<span style="color: #000000;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">&quot;connection.connection_string&quot;</span>, ConnectionString<span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; properties.<span style="color: #000000;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">&quot;connection.provider&quot;</span>, <span style="color: #0600FF;">&quot;NHibernate.Connection.DriverConnectionProvider&quot;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; properties.<span style="color: #000000;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">&quot;dialect&quot;</span>, <span style="color: #0600FF;">&quot;NHibernate.Dialect.MsSql2005Dialect&quot;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; properties.<span style="color: #000000;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">&quot;connection.driver_class&quot;</span>, <span style="color: #0600FF;">&quot;NHibernate.Driver.SqlClientDriver&quot;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; properties.<span style="color: #000000;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">&quot;show_sql&quot;</span>, <span style="color: #0600FF;">&quot;true&quot;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; properties.<span style="color: #000000;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">&quot;proxyfactory.factory_class&quot;</span>, <span style="color: #0600FF;">&quot;NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu&quot;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> autoMappings = AutoPersistenceModel _</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #000000;">MapEntitiesFromAssemblyOf</span><span style="color: #000000;">&#40;</span>Of Person<span style="color: #000000;">&#41;</span> _</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #000000;">Where</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">Function</span><span style="color: #000000;">&#40;</span>t<span style="color: #000000;">&#41;</span> t.<span style="color: #000000;">Namespace</span> = <span style="color: #0600FF;">&quot;fluentnhibernatetest.Model&quot;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SessionFactory = <span style="color: #0600FF;">New</span> NHibernate.<span style="color: #000000;">Cfg</span>.<span style="color: #000000;">Configuration</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> _</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #000000;">AddProperties</span><span style="color: #000000;">&#40;</span>properties<span style="color: #000000;">&#41;</span> _</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #000000;">AddAutoMappings</span><span style="color: #000000;">&#40;</span>autoMappings<span style="color: #000000;">&#41;</span> _</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #000000;">BuildSessionFactory</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return SessionFactory</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span></li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Class</span></li><li style="" class="li2"><span style="color: #0600FF;">End</span> Namespace</li></ol></div><div id="cb72981" style="display: none; color: red;"></div></div></div>

<p>which meant I also had to import and reference the NHibernate.ByteCode.Linfu project/assembly. Cant't remember ever needing that.</p>

<p>And of course I also neede something to run this and see if it worked. Of course I could have created a testproject but what's the fun in that.</p>

<div class="codebox"><div class="codeheader"><span>vbnet</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb12620'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb12620','cb55025'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="vbnet" id="cb12620" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1"><span style="color: #0600FF;">Option</span> Infer <span style="color: #0600FF;">On</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1">Imports fluentnhibernatetest.<span style="color: #000000;">Model</span></li><li style="" class="li2">Imports NHibernate</li><li style="" class="li1">&nbsp;</li><li style="" class="li2"><span style="color: #0600FF;">Module</span> Module1</li><li style="" class="li1">&nbsp;</li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #0600FF;">Sub</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; Try</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> sessionfactory = Dal.<span style="color: #000000;">nHibernateConfiguration</span>.<span style="color: #000000;">confignhibernate</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> session <span style="color: #0600FF;">As</span> ISession = sessionfactory.<span style="color: #000000;">OpenSession</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> _ReturnList = session.<span style="color: #000000;">CreateCriteria</span><span style="color: #000000;">&#40;</span>GetType<span style="color: #000000;">&#40;</span>Model.<span style="color: #000000;">Person</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>.<span style="color: #000000;">List</span><span style="color: #000000;">&#40;</span>Of Model.<span style="color: #000000;">Person</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">For</span> Each Person In _ReturnList</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #000000;">WriteLine</span><span style="color: #000000;">&#40;</span>Person.<span style="color: #000000;">Id</span>.<span style="color: #000000;">ToString</span> &amp; <span style="color: #0600FF;">&quot; &quot;</span> &amp; Person.<span style="color: #000000;">LastName</span> &amp; <span style="color: #0600FF;">&quot; &quot;</span> &amp; Person.<span style="color: #000000;">FirstName</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Next</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; Catch ex <span style="color: #0600FF;">As</span> Exception</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #000000;">WriteLine</span><span style="color: #000000;">&#40;</span>ex.<span style="color: #000000;">Message</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #000000;">WriteLine</span><span style="color: #000000;">&#40;</span>ex.<span style="color: #000000;">StackTrace</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> Try</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #000000;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Module</span></li></ol></div><div id="cb55025" style="display: none; color: red;"></div></div></div>

<p>With this as the result of all our hard labor.</p>

<div class="image_block"><img src="http://blogs.lessthandot.com/media/blogs/Architect/fluentnhibernateresult.jpg" alt="" title="" width="668" height="335" /></div><p> </p>

<p>Not that difficult ;-). </p>

<p>I will do a more elaborate test later on.</p>

<p>Once again thanks to the guys that sacrificied their time and energy in making this happen.</p>

<p>you can also find more examples in C# <a href="http://blog.jagregory.com/2009/01/11/fluent-nhibernate-auto-mapping-entity-conventions/">here</a> by <a href="http://blog.jagregory.com/">James Gregory</a>.</p><div class="item_footer"><p><small><a href="http://blogs.lessthandot.com/index.php/Architect/DesigningSoftware/automapping-fluent-nhibernate-and-vb-net">Original post</a> blogged on <a href="http://lessthandot.com/">LessThanDot</a>.</small></p></div>]]></content:encoded>
								<comments>http://blogs.lessthandot.com/index.php/Architect/DesigningSoftware/automapping-fluent-nhibernate-and-vb-net#comments</comments>
			<wfw:commentRss>http://blogs.lessthandot.com/index.php/Architect/?tempskin=_rss2&#38;disp=comments&#38;p=290</wfw:commentRss>
		</item>
				<item>
			<title>DDD is not all or nothing</title>
			<link>http://blogs.lessthandot.com/index.php/Architect/DesigningSoftware/ddd-is-not-all-or-nothing</link>
			<pubDate>Tue, 06 Jan 2009 05:34:22 +0000</pubDate>			<dc:creator>Christiaan Baes (chrissie1)</dc:creator>
			<category domain="main">Designing Software</category>			<guid isPermaLink="false">281@http://blogs.lessthandot.com/</guid>
						<description>&lt;p&gt;Today, &lt;a href=&quot;http://www.lostechies.com/blogs/jimmy_bogard/default.aspx&quot;&gt;Jimmy Bogard&lt;/a&gt; made a &lt;a href=&quot;http://www.lostechies.com/blogs/jimmy_bogard/archive/2009/01/05/ddd-is-not-all-or-nothing.aspx&quot;&gt;post&lt;/a&gt; over at &lt;a href=&quot;http://www.lostechies.com/&quot;&gt;LosTechies.com&lt;/a&gt; about DDD and it not being about patterns but all about the Domain and how you model it.&lt;/p&gt;

&lt;p&gt;Since his words are better then mine, I would like to quote him.&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;One question Rob Conery asked me during a conversation on DDD was, &amp;#8220;How do I recognize an application built with DDD?&amp;#8221;  We&amp;#8217;ve already noted that you can&amp;#8217;t look towards a set of patterns, so how do we recognize one?  A DDD application is one whose design is driven by the domain, hence &amp;#8220;Domain-Driven Design&amp;#8221;.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;I think he has a point. Domain driven design should make the domain the first and most important aspect of the application. I think it&#039;s also the most natural way to implement OOP. &lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;Another tactic to recognizing DDD is have both the domain experts and team explain the domain.  Counting the number of clarifications and special cases, &amp;#8220;well, except, but&amp;#8221; and &amp;#8220;we&amp;#8221; versus &amp;#8220;they&amp;#8221; provides a good indication that the domain experts and team are not on the same page.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Of course, it will never be perfect, since the domain experts sometimes forget to tell certain things to the team. But then, at the end of the process, the team should be domain experts too, to a point at least. They may lack the experience but they should know most of the process, if they don&#039;t, then they haven&#039;t understood the process. So, if you model a milk route for a milkman, you don&#039;t have to go around taking out the milk for 5 weeks in a row, but you should have at least been there once. &lt;/p&gt;

&lt;p&gt;REMEMBER, you can&#039;t always trust the domain experts to tell you everything they know. They sometimes take things for granted that aren&#039;t as obvious to a third party. &lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;DDD is an architectural style that encourages model-driven design and a domain-driven model.  Following this style is following DDD, and merely implementing patterns only indicates that we can implement patterns.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;That summed it up quite nicely for me.&lt;/p&gt;

&lt;p&gt;I would also like to add that DDD is not about what library you use and the domain is also OO-language agnostic. The implementation might vary a little from language to language but it should turn out to be the same in the end.&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://blogs.lessthandot.com/index.php/Architect/DesigningSoftware/ddd-is-not-all-or-nothing&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://lessthandot.com/&quot;&gt;LessThanDot&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>Today, <a href="http://www.lostechies.com/blogs/jimmy_bogard/default.aspx">Jimmy Bogard</a> made a <a href="http://www.lostechies.com/blogs/jimmy_bogard/archive/2009/01/05/ddd-is-not-all-or-nothing.aspx">post</a> over at <a href="http://www.lostechies.com/">LosTechies.com</a> about DDD and it not being about patterns but all about the Domain and how you model it.</p>

<p>Since his words are better then mine, I would like to quote him.</p>

<blockquote><p>One question Rob Conery asked me during a conversation on DDD was, &#8220;How do I recognize an application built with DDD?&#8221;  We&#8217;ve already noted that you can&#8217;t look towards a set of patterns, so how do we recognize one?  A DDD application is one whose design is driven by the domain, hence &#8220;Domain-Driven Design&#8221;.</p></blockquote>

<p>I think he has a point. Domain driven design should make the domain the first and most important aspect of the application. I think it's also the most natural way to implement OOP. </p>

<blockquote><p>Another tactic to recognizing DDD is have both the domain experts and team explain the domain.  Counting the number of clarifications and special cases, &#8220;well, except, but&#8221; and &#8220;we&#8221; versus &#8220;they&#8221; provides a good indication that the domain experts and team are not on the same page.</p></blockquote>

<p>Of course, it will never be perfect, since the domain experts sometimes forget to tell certain things to the team. But then, at the end of the process, the team should be domain experts too, to a point at least. They may lack the experience but they should know most of the process, if they don't, then they haven't understood the process. So, if you model a milk route for a milkman, you don't have to go around taking out the milk for 5 weeks in a row, but you should have at least been there once. </p>

<p>REMEMBER, you can't always trust the domain experts to tell you everything they know. They sometimes take things for granted that aren't as obvious to a third party. </p>

<blockquote><p>DDD is an architectural style that encourages model-driven design and a domain-driven model.  Following this style is following DDD, and merely implementing patterns only indicates that we can implement patterns.</p></blockquote>

<p>That summed it up quite nicely for me.</p>

<p>I would also like to add that DDD is not about what library you use and the domain is also OO-language agnostic. The implementation might vary a little from language to language but it should turn out to be the same in the end.</p><div class="item_footer"><p><small><a href="http://blogs.lessthandot.com/index.php/Architect/DesigningSoftware/ddd-is-not-all-or-nothing">Original post</a> blogged on <a href="http://lessthandot.com/">LessThanDot</a>.</small></p></div>]]></content:encoded>
								<comments>http://blogs.lessthandot.com/index.php/Architect/DesigningSoftware/ddd-is-not-all-or-nothing#comments</comments>
			<wfw:commentRss>http://blogs.lessthandot.com/index.php/Architect/?tempskin=_rss2&#38;disp=comments&#38;p=281</wfw:commentRss>
		</item>
				<item>
			<title>Isolator For SharePoint</title>
			<link>http://blogs.lessthandot.com/index.php/Architect/IntroductionArchitectureDesign/isolator-for-sharepoint</link>
			<pubDate>Tue, 25 Nov 2008 06:13:52 +0000</pubDate>			<dc:creator>Christiaan Baes (chrissie1)</dc:creator>
			<category domain="main">Introduction to Architecture &amp; Design</category>			<guid isPermaLink="false">226@http://blogs.lessthandot.com/</guid>
						<description>&lt;p&gt;If you have Sharepoint you should perhaps try out this new software.&lt;/p&gt;

&lt;p&gt;Typemock are offering their new product for &lt;a href=&quot;http://www.typemock.com/sharepointpage.php?utm_source=sp_bb&amp;amp;utm_medium=blog_4sp&amp;amp;utm_campaign=sp_bb&quot;&gt;unit testing SharePoint&lt;/a&gt; called Isolator For SharePoint, for a special introduction price. it is the only tool that allows you to &lt;a href=&quot;http://blog.typemock.com/2008/11/newisolatorforsharepointtoolforunittest.html?utm_source=typeblog&amp;amp;utm_medium=sp_bb&amp;amp;utm_campaign=typeblog&quot;&gt;unit test SharePoint&lt;/a&gt; without a SharePoint server. To learn more &lt;a href=&quot;http://www.typemock.com/sharepointpage.php?utm_source=sp_bb&amp;amp;utm_medium=blog_4sp&amp;amp;utm_campaign=sp_bb&quot;&gt;click here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The first 50 bloggers&lt;/strong&gt; who blog this text in their blog and tell us about it, will get &lt;em&gt;a Full Isolator license&lt;/em&gt;, Free. for rules and info &lt;a href=&quot;http://blog.typemock.com/2008/11/newisolatorforsharepointtoolforunittest.html&quot;&gt;click here&lt;/a&gt;.&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://blogs.lessthandot.com/index.php/Architect/IntroductionArchitectureDesign/isolator-for-sharepoint&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://lessthandot.com/&quot;&gt;LessThanDot&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>If you have Sharepoint you should perhaps try out this new software.</p>

<p>Typemock are offering their new product for <a href="http://www.typemock.com/sharepointpage.php?utm_source=sp_bb&amp;utm_medium=blog_4sp&amp;utm_campaign=sp_bb">unit testing SharePoint</a> called Isolator For SharePoint, for a special introduction price. it is the only tool that allows you to <a href="http://blog.typemock.com/2008/11/newisolatorforsharepointtoolforunittest.html?utm_source=typeblog&amp;utm_medium=sp_bb&amp;utm_campaign=typeblog">unit test SharePoint</a> without a SharePoint server. To learn more <a href="http://www.typemock.com/sharepointpage.php?utm_source=sp_bb&amp;utm_medium=blog_4sp&amp;utm_campaign=sp_bb">click here</a>.</p>

<p><strong>The first 50 bloggers</strong> who blog this text in their blog and tell us about it, will get <em>a Full Isolator license</em>, Free. for rules and info <a href="http://blog.typemock.com/2008/11/newisolatorforsharepointtoolforunittest.html">click here</a>.</p><div class="item_footer"><p><small><a href="http://blogs.lessthandot.com/index.php/Architect/IntroductionArchitectureDesign/isolator-for-sharepoint">Original post</a> blogged on <a href="http://lessthandot.com/">LessThanDot</a>.</small></p></div>]]></content:encoded>
								<comments>http://blogs.lessthandot.com/index.php/Architect/IntroductionArchitectureDesign/isolator-for-sharepoint#comments</comments>
			<wfw:commentRss>http://blogs.lessthandot.com/index.php/Architect/?tempskin=_rss2&#38;disp=comments&#38;p=226</wfw:commentRss>
		</item>
				<item>
			<title>The donkey and unit testing</title>
			<link>http://blogs.lessthandot.com/index.php/Architect/IntroductionArchitectureDesign/the-donkey-and-unit-testing</link>
			<pubDate>Fri, 21 Nov 2008 08:55:10 +0000</pubDate>			<dc:creator>Christiaan Baes (chrissie1)</dc:creator>
			<category domain="main">Introduction to Architecture &amp; Design</category>			<guid isPermaLink="false">222@http://blogs.lessthandot.com/</guid>
						<description>&lt;p&gt;In dutch there is this saying.&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;Een ezel stoot zich nooit tweemaal aan dezelfde steen.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;A literal translation would go like this.&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;A donkey never bumps into the same stone twice.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;or&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;Even a donkey does not bump himself twice against the same stone&amp;#8230; &lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;A less literal translation would be this.&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;Fool me once, shame on you. fool me twice, shame on me.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;So unit testing is all about being the donkey or the fool or both ;-).&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://blogs.lessthandot.com/index.php/Architect/IntroductionArchitectureDesign/the-donkey-and-unit-testing&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://lessthandot.com/&quot;&gt;LessThanDot&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>In dutch there is this saying.</p>

<blockquote><p>Een ezel stoot zich nooit tweemaal aan dezelfde steen.</p></blockquote>

<p>A literal translation would go like this.</p>

<blockquote><p>A donkey never bumps into the same stone twice.</p></blockquote>

<p>or</p>

<blockquote><p>Even a donkey does not bump himself twice against the same stone&#8230; </p></blockquote>

<p>A less literal translation would be this.</p>

<blockquote><p>Fool me once, shame on you. fool me twice, shame on me.</p></blockquote>

<p>So unit testing is all about being the donkey or the fool or both ;-).</p><div class="item_footer"><p><small><a href="http://blogs.lessthandot.com/index.php/Architect/IntroductionArchitectureDesign/the-donkey-and-unit-testing">Original post</a> blogged on <a href="http://lessthandot.com/">LessThanDot</a>.</small></p></div>]]></content:encoded>
								<comments>http://blogs.lessthandot.com/index.php/Architect/IntroductionArchitectureDesign/the-donkey-and-unit-testing#comments</comments>
			<wfw:commentRss>http://blogs.lessthandot.com/index.php/Architect/?tempskin=_rss2&#38;disp=comments&#38;p=222</wfw:commentRss>
		</item>
				<item>
			<title>Why English is really important to us non-english speakers.</title>
			<link>http://blogs.lessthandot.com/index.php/Architect/DesigningSoftware/why-english-is-really-important-to-us-no</link>
			<pubDate>Tue, 18 Nov 2008 19:43:00 +0000</pubDate>			<dc:creator>Christiaan Baes (chrissie1)</dc:creator>
			<category domain="main">Designing Software</category>			<guid isPermaLink="false">216@http://blogs.lessthandot.com/</guid>
						<description>&lt;p&gt;Today I read &lt;a href=&quot;http://www.codinghorror.com/blog/archives/001188.html&quot;&gt;We are Typists first, Programmers second&lt;/a&gt; by &lt;a href=&quot;http://www.codinghorror.com/blog/&quot;&gt;Jeff Atwood&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The man has a point but that&amp;#8217;s not what I want to talk about. I want to talk about the fact that the IT business seems to be centered around the English language. Don&amp;#8217;t get me wrong, that is not bad, I think it is actually a good thing that we can speak the same language around the world. This also means that our relatively small world is much bigger than if we stuck to our own language. &lt;/p&gt;

&lt;p&gt;In my case, that would be Dutch, on a global scale Dutch is a very small language, so the number of good Dutch speaking IT people is fairly small too. With the large number of different technologies and job descriptions in the IT world, it would be hard to find a lot of Senior VB.Net people that also happen to blog and use Structuremap at the same time ;-). There even seems to be a very small number of them around the world if you account for all the non-Dutch-speaking people.&lt;/p&gt;

&lt;p&gt;And that&amp;#8217;s why people tend to use English as a main language in IT. I think it all started because BASIC was so popular and based on the English language. Even Pascal was very English based and then came SQL and many other verbose programming-languages. And us non-English speaking people adapted and learned English to better understand.&lt;/p&gt;

&lt;p&gt;I can tell you that Microsoft tried to change the syntax to make it more human language independent. I know that in Excel 5.0 you had the option to set the VBA syntax to Dutch and program in Dutch. And that just felt weird. I don&amp;#8217;t know if they do that anymore but it was funny and very difficult to program basic in your own language when you are used to programming Basic in English, it just felt wrong. And that is weird ;-). It felt funny because they needed to translate English keywords to Dutch keywords and sometimes the correct translations just isn&amp;#8217;t one word in another language. &lt;/p&gt;

&lt;p&gt;So getting to know English is a must, and it can be quit a task when you have had no formal education in English. So like Jeff, who taught himself how to type, I taught myself English. Yes, I know I&amp;#8217;m not a hundred percent, but like &lt;a href=&quot;http://ayende.com/Blog/&quot;&gt;Ayende Rahien (Oren Eini)&lt;/a&gt; used to say &amp;#8220;Correct spelling is optional&quot;. And he too has made plenty of progress over the years, just look at his first blogposts and the last. &lt;/p&gt;

&lt;p&gt;So we non-English speakers have a double challenge, learning how to program the correct way and learning a language to learn how to program. &lt;/p&gt;

&lt;p&gt;You English speaking IT-ers have an edge on us but you don&amp;#8217;t even seem to realize it. Not that we hold that against you. &lt;/p&gt;

&lt;p&gt;So coming back to Jeff&amp;#8217;s post. According to &lt;a href=&quot;http://play.typeracer.com/&quot;&gt;Type racer&lt;/a&gt; (which is big fun BTW) I do 39 wpm in English. which isn&amp;#8217;t that bad. I&amp;#8217;m pretty sure I do much better in Dutch since I have to think less about correct spelling (meaning I don&amp;#8217;t have to read some words four times before I understand them). &lt;/p&gt;

&lt;p&gt;And yes we now have built-in spellcheckers for everything. And all spellcheckers work for English (most variants) so use them.&lt;/p&gt;

&lt;p&gt;So for us non-English speaking programmers, I would change Jeff&amp;#8217;s quote:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;So if you want to become a great programmer, start by becoming a great typist.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;to&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;So if you want to become a great programmer, start by learning English and then becoming a great typist.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;PS: Try &lt;a href=&quot;http://play.typeracer.com/&quot;&gt;Type Racer&lt;/a&gt; It&amp;#8217;s big fun and seems to help me learn to spell better, so now I only have to learn how to write great stories like Jeff does ;-).&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://blogs.lessthandot.com/index.php/Architect/DesigningSoftware/why-english-is-really-important-to-us-no&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://lessthandot.com/&quot;&gt;LessThanDot&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>Today I read <a href="http://www.codinghorror.com/blog/archives/001188.html">We are Typists first, Programmers second</a> by <a href="http://www.codinghorror.com/blog/">Jeff Atwood</a>.</p>

<p>The man has a point but that&#8217;s not what I want to talk about. I want to talk about the fact that the IT business seems to be centered around the English language. Don&#8217;t get me wrong, that is not bad, I think it is actually a good thing that we can speak the same language around the world. This also means that our relatively small world is much bigger than if we stuck to our own language. </p>

<p>In my case, that would be Dutch, on a global scale Dutch is a very small language, so the number of good Dutch speaking IT people is fairly small too. With the large number of different technologies and job descriptions in the IT world, it would be hard to find a lot of Senior VB.Net people that also happen to blog and use Structuremap at the same time ;-). There even seems to be a very small number of them around the world if you account for all the non-Dutch-speaking people.</p>

<p>And that&#8217;s why people tend to use English as a main language in IT. I think it all started because BASIC was so popular and based on the English language. Even Pascal was very English based and then came SQL and many other verbose programming-languages. And us non-English speaking people adapted and learned English to better understand.</p>

<p>I can tell you that Microsoft tried to change the syntax to make it more human language independent. I know that in Excel 5.0 you had the option to set the VBA syntax to Dutch and program in Dutch. And that just felt weird. I don&#8217;t know if they do that anymore but it was funny and very difficult to program basic in your own language when you are used to programming Basic in English, it just felt wrong. And that is weird ;-). It felt funny because they needed to translate English keywords to Dutch keywords and sometimes the correct translations just isn&#8217;t one word in another language. </p>

<p>So getting to know English is a must, and it can be quit a task when you have had no formal education in English. So like Jeff, who taught himself how to type, I taught myself English. Yes, I know I&#8217;m not a hundred percent, but like <a href="http://ayende.com/Blog/">Ayende Rahien (Oren Eini)</a> used to say &#8220;Correct spelling is optional". And he too has made plenty of progress over the years, just look at his first blogposts and the last. </p>

<p>So we non-English speakers have a double challenge, learning how to program the correct way and learning a language to learn how to program. </p>

<p>You English speaking IT-ers have an edge on us but you don&#8217;t even seem to realize it. Not that we hold that against you. </p>

<p>So coming back to Jeff&#8217;s post. According to <a href="http://play.typeracer.com/">Type racer</a> (which is big fun BTW) I do 39 wpm in English. which isn&#8217;t that bad. I&#8217;m pretty sure I do much better in Dutch since I have to think less about correct spelling (meaning I don&#8217;t have to read some words four times before I understand them). </p>

<p>And yes we now have built-in spellcheckers for everything. And all spellcheckers work for English (most variants) so use them.</p>

<p>So for us non-English speaking programmers, I would change Jeff&#8217;s quote:</p>

<blockquote><p>So if you want to become a great programmer, start by becoming a great typist.</p></blockquote>

<p>to</p>

<blockquote><p>So if you want to become a great programmer, start by learning English and then becoming a great typist.</p></blockquote>

<p>PS: Try <a href="http://play.typeracer.com/">Type Racer</a> It&#8217;s big fun and seems to help me learn to spell better, so now I only have to learn how to write great stories like Jeff does ;-).</p><div class="item_footer"><p><small><a href="http://blogs.lessthandot.com/index.php/Architect/DesigningSoftware/why-english-is-really-important-to-us-no">Original post</a> blogged on <a href="http://lessthandot.com/">LessThanDot</a>.</small></p></div>]]></content:encoded>
								<comments>http://blogs.lessthandot.com/index.php/Architect/DesigningSoftware/why-english-is-really-important-to-us-no#comments</comments>
			<wfw:commentRss>http://blogs.lessthandot.com/index.php/Architect/?tempskin=_rss2&#38;disp=comments&#38;p=216</wfw:commentRss>
		</item>
			</channel>
</rss>
