<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Ira Lukhezo&#039;s blog &#187; Search Results  &#187;  code+contracts</title>
	<atom:link href="http://lukhezo.com/search/code+contracts/feed/rss2/" rel="self" type="application/rss+xml" />
	<link>http://lukhezo.com</link>
	<description>.NET Haberdasher</description>
	<lastBuildDate>Wed, 11 Jan 2012 19:03:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='lukhezo.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Ira Lukhezo&#039;s blog &#187; Search Results  &#187;  code+contracts</title>
		<link>http://lukhezo.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://lukhezo.com/osd.xml" title="Ira Lukhezo&#039;s blog" />
	<atom:link rel='hub' href='http://lukhezo.com/?pushpress=hub'/>
		<item>
		<title>Code Contracts forthcoming in Visual Studio 2010 and .NET 4.0</title>
		<link>http://lukhezo.com/2009/02/25/code-contracts-forthcoming-in-net-40/</link>
		<comments>http://lukhezo.com/2009/02/25/code-contracts-forthcoming-in-net-40/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 10:26:32 +0000</pubDate>
		<dc:creator>Ira Lukhezo</dc:creator>
				<category><![CDATA[Code Contracts]]></category>

		<guid isPermaLink="false">http://castalian.wordpress.com/2009/02/25/code-contracts-forthcoming-in-net-40/</guid>
		<description><![CDATA[I am really excited that Code Contracts are etched in to be added to the Base Class Library in .NET 4.0. This abundant excitation is genuine, so-much-so I got up at an ungodly hour this morning, planning, scheming and envisaging getting my hands on the new Library. Code Contracts allow you to express preconditions, postconditions [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lukhezo.com&amp;blog=2467070&amp;post=725&amp;subd=castalian&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I am really excited that Code Contracts are etched in to be added to the Base Class Library in .NET 4.0. This abundant excitation is genuine, so-much-so I got up at an ungodly hour this morning, planning, scheming and envisaging getting my hands on the new Library.</p>
<p>Code Contracts allow you to express <em>preconditions</em>, <em>postconditions</em> and <em>object invariants</em> in your code for runtime checking, static analysis, and documentation. You may be aware of <a href="http://ira.me.uk/2008/09/01/switch-offon-visual-studio-2008-background-compilation/">background compilation</a> that was added to the C# compiler in Visual Studio 2008 SP1. This is a real advance for static type languages like C# and Visual Basic, because you can start to be <em>explicit</em> about how your code will behave, as it is written, and errors caught even before you compile the program.</p>
<p>Presently, imperative programming languages are ill equipped to deal with the issue of concurrency, and the many core shift in personal computers. One of the chief obstacles in designing parallel code, is the issue of <a href="http://en.wikipedia.org/wiki/Side_effect_(computer_science)">side effects</a>. Contracts don’t offer the benefits of functional programming <em>per se</em>, but they do make your code more easier to predict, which is going to be a key tool in development going forward, as I don’t see all the imperative programmers in the world, and billions of lines of imperative code suddenly being converted into functional code.</p>
<p>The best way to demonstrate this, is through an example. Before that though, feel free to download the Code Contracts library from <a href="http://research.microsoft.com/en-us/projects/contracts/">Microsoft Research</a>. Presently, I am using the academic license which works with Visual Studio Professional, if you do choose to use the commercial license, you will need Visual Studio 2008 Team System. You also want to download the documentation from <a href="http://msdn.microsoft.com/en-us/devlabs/dd491992.aspx">here</a>, and keep an eye out for developments at the BCL Team <a href="http://blogs.msdn.com/bclteam/archive/tags/Contracts/default.aspx">blog</a>.</p>
<p><strong>Note:</strong> This tutorial is in both C# and Visual Basic</p>
<h5>Common Problem</h5>
<p>I have a simple class, that demonstrates very well (however simple it might be) what happens in real world development, pretty much on a daily basis. I am creating a class called Rational (go <a href="http://en.wikipedia.org/wiki/Rational_number">here</a> if you don’t know what a rational number is) , instantiating it, and passing in a couple of values. What you you think happens when I hit F5 to run the program?</p>
<h3>Visual Basic</h3>
<div style="font-family:courier new;background:white;color:black;font-size:10pt;">
<p style="margin:0;"><span style="color:blue;">Module</span> Module1</p>
<p style="margin:0;">&#160;&#160;&#160; <span style="color:green;">&#8216; Simple class to represent rational numbers</span></p>
<p style="margin:0;">&#160;&#160;&#160; <span style="color:blue;">Public</span> <span style="color:blue;">Class</span> Rational</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">Private</span> numerator <span style="color:blue;">As</span> <span style="color:blue;">Integer</span></p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">Private</span> denominator <span style="color:blue;">As</span> <span style="color:blue;">Integer</span></p>
<p style="margin:0;">&#160;</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">Public</span> <span style="color:blue;">Sub</span> <span style="color:blue;">New</span>(<span style="color:blue;">ByVal</span> numerator <span style="color:blue;">As</span> <span style="color:blue;">Integer</span>, <span style="color:blue;">ByVal</span> denominator <span style="color:blue;">As</span> <span style="color:blue;">Integer</span>)</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">Me</span>.numerator = numerator</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">Me</span>.denominator = denominator</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">End</span> <span style="color:blue;">Sub</span></p>
<p style="margin:0;">&#160;</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:green;">&#8216; Method returns the closest integer by truncation</span></p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">Public</span> <span style="color:blue;">Function</span> ToInt() <span style="color:blue;">As</span> <span style="color:blue;">Integer</span></p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">Return</span> <span style="color:blue;">Me</span>.numerator / <span style="color:blue;">Me</span>.denominator</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">End</span> <span style="color:blue;">Function</span></p>
<p style="margin:0;">&#160;&#160;&#160; <span style="color:blue;">End</span> <span style="color:blue;">Class</span></p>
<p style="margin:0;">&#160;</p>
<p style="margin:0;">&#160;&#160;&#160; <span style="color:blue;">Sub</span> Main()</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">Dim</span> rational <span style="color:blue;">As</span> <span style="color:blue;">New</span> Rational(3, 0)</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; Console.WriteLine(rational.ToInt())</p>
<p style="margin:0;">&#160;&#160;&#160; <span style="color:blue;">End</span> <span style="color:blue;">Sub</span></p>
<p style="margin:0;">&#160;</p>
<p style="margin:0;"><span style="color:blue;">End</span> <span style="color:blue;">Module</span></p>
</p></div>
<h3>C#</h3>
<div style="font-family:courier new;background:white;color:black;font-size:10pt;">
<div style="font-family:courier new;background:white;color:black;font-size:10pt;">
<p style="margin:0;"><span style="color:blue;">using</span> System;</p>
<p style="margin:0;"><span style="color:blue;">using</span> System.Diagnostics.Contracts;</p>
<p style="margin:0;">&#160;</p>
<p style="margin:0;"><span style="color:blue;">namespace</span> CodeContractsDemo</p>
<p style="margin:0;">{</p>
<p style="margin:0;">&#160;&#160; <span style="color:green;">// Simple class to represent rational numbers</span></p>
<p style="margin:0;">&#160;&#160;&#160; <span style="color:blue;">public</span> <span style="color:blue;">class</span> <span style="color:#2b91af;">Rational</span></p>
<p style="margin:0;">&#160;&#160;&#160; {</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">int</span> numerator;</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">int</span> denominator;</p>
<p style="margin:0;">&#160;</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">public</span> Rational(<span style="color:blue;">int</span> numerator, <span style="color:blue;">int</span> denominator)</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">this</span>.numerator = numerator;</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">this</span>.denominator = denominator;</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
<p style="margin:0;">&#160;</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:green;">// Method returns the closest integer by truncation</span></p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">public</span> <span style="color:blue;">int</span> ToInt()</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">return</span> <span style="color:blue;">this</span>.numerator / <span style="color:blue;">this</span>.denominator;</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
<p style="margin:0;">&#160;</p>
<p style="margin:0;">&#160;&#160;&#160; }</p>
<p style="margin:0;">&#160;&#160;&#160; <span style="color:blue;">class</span> <span style="color:#2b91af;">Program</span></p>
<p style="margin:0;">&#160;&#160;&#160; {</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">static</span> <span style="color:blue;">void</span> Main(<span style="color:blue;">string</span>[] args)</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:#2b91af;">Rational</span> rational = <span style="color:blue;">new</span> <span style="color:#2b91af;">Rational</span>(3,0);</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:#2b91af;">Console</span>.WriteLine(rational.ToInt());</p>
<p style="margin:0;">&#160;</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
<p style="margin:0;">&#160;&#160;&#160; }</p>
<p style="margin:0;">}</p>
</p></div>
<p style="margin:0;">&#160;</p>
<p style="margin:0;">Well you guessed it!</p>
<h3>Visual Basic Error </h3>
<p style="margin:0;"><a href="http://castalian.files.wordpress.com/2009/02/overflowexception.png"><img style="display:inline;border-width:0;" title="OverflowException" border="0" alt="OverflowException" src="http://castalian.files.wordpress.com/2009/02/overflowexception-thumb.png?w=688&#038;h=360" width="688" height="360" /></a></p>
<p style="margin:0;">&#160;</p>
<h3>C# Error</h3>
</p></div>
<p><a href="http://castalian.files.wordpress.com/2009/02/dividebyzeroexception.png"><img style="display:inline;border-width:0;" title="DivideByZeroException" border="0" alt="DivideByZeroException" src="http://castalian.files.wordpress.com/2009/02/dividebyzeroexception-thumb.png?w=658&#038;h=351" width="658" height="351" /></a></p>
<p>This is such a frequent programming mistake, whereby parameters are added that end up causing problems further down the line. Who knows how long it has been since the rational class was first created, and the operation of passing in the zero denominator?</p>
<p><strong>Note:</strong> When you installed Code Contracts from Devlabs, the necessary .dll was added to your machine. In C# right click the references node in Solution Explorer and go to add a reference (In Visual Basic double click MyProject in Solution Explorer and select the References tab on the left and select add) to Microsoft.Contracts Library. This will be included in MSCORLIB in .NET 4.0.</p>
<p><a href="http://castalian.files.wordpress.com/2009/02/contractslibrary.png"><img style="display:inline;border-width:0;" title="ContractsLibrary" border="0" alt="ContractsLibrary" src="http://castalian.files.wordpress.com/2009/02/contractslibrary-thumb.png?w=499&#038;h=423" width="499" height="423" /></a></p>
<p>You should now find that you can include the System.Diagnostics.Contracts namespace to the top of your class</p>
<h3>Visual Basic</h3>
<div style="font-family:courier new;background:white;color:black;font-size:10pt;">
<p style="margin:0;"><span style="color:blue;">Imports</span> System.Diagnostics.Contracts</p>
</p></div>
<h3>C#</h3>
<div style="font-family:courier new;background:white;color:black;font-size:10pt;">
<p style="margin:0;"><span style="color:blue;">using</span> System.Diagnostics.Contracts;</p>
</p></div>
<h4>Code Contracts</h4>
<p>Code Contracts are designed to preclude such eventualities from ever occurring in the first place, and to prevent them really <em>early</em> on, without the need to run the program first. This in some ways illustrates the limits of background compilation, which itself is not a limitation, but the point of inflexion whereby a developer starts to create an algorithm. The background compiler cannot deduce what a developer wants to do beforehand, if it could, we’d all be out of a job.</p>
<p>I need a way to disallow the client from ever passing in a zero denominator. Typically, today, I would write some parameter validation code in the constructor, that throws an exception.</p>
<p>Add the following code to the constructor of the class above (I have decided I want just positive numbers now)</p>
<h3>Visual Basic</h3>
<div style="font-family:courier new;background:white;color:black;font-size:10pt;">
<p style="margin:0;">&#160;&#160;&#160;&#160; <span style="color:blue;">Public</span> <span style="color:blue;">Sub</span> <span style="color:blue;">New</span>(<span style="color:blue;">ByVal</span> numerator <span style="color:blue;">As</span> <span style="color:blue;">Integer</span>, <span style="color:blue;">ByVal</span> denominator <span style="color:blue;">As</span> <span style="color:blue;">Integer</span>)</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Contract.Requires(0 &lt; denominator)</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">Me</span>.numerator = numerator</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">Me</span>.denominator = denominator</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">End</span> <span style="color:blue;">Sub</span></p>
</p></div>
<h3>C#</h3>
<div style="font-family:courier new;background:white;color:black;font-size:10pt;">
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">public</span> Rational(<span style="color:blue;">int</span> numerator, <span style="color:blue;">int</span> denominator)</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:#2b91af;">Contract</span>.Requires(0 &lt; denominator);</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">this</span>.numerator = numerator;</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">this</span>.denominator = denominator;</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
</p></div>
<p>When you installed the contracts library, a new Code Contracts tab was added to your project. In C# double click the Properties node in Solution Explorer in Visual Basic, double click MyProject in Solution Explorer</p>
<p><a href="http://castalian.files.wordpress.com/2009/02/visualstudio.png"><img style="display:inline;border-width:0;" title="VisualStudio" border="0" alt="VisualStudio" src="http://castalian.files.wordpress.com/2009/02/visualstudio-thumb.png?w=717&#038;h=491" width="717" height="491" /></a></p>
<p>Place a check in the “Perform Runtime Contract Checking” checkbox, return to the project and hit F5 to run the project.</p>
<p>You should find you have the following (Note: the failure is a Precondition)</p>
<p><a href="http://castalian.files.wordpress.com/2009/02/precondition.png"><img style="display:inline;border-width:0;" title="PreCondition" border="0" alt="PreCondition" src="http://castalian.files.wordpress.com/2009/02/precondition-thumb.png?w=509&#038;h=524" width="509" height="524" /></a></p>
<p>This Debug.Assert is called upon instantiation of the class, and does not occur further down the line when ToInt() is called.</p>
<p>Return to the Code Contracts tab, and this time check “Perform Static Contract Checking” and build</p>
<p><a href="http://castalian.files.wordpress.com/2009/02/staticaswell.png"><img style="display:inline;border-width:0;" title="StaticAsWell" border="0" alt="StaticAsWell" src="http://castalian.files.wordpress.com/2009/02/staticaswell-thumb.png?w=418&#038;h=297" width="418" height="297" /></a></p>
<p>You should now find that you have warnings in your error list</p>
<h3>Visual Basic</h3>
<p><a href="http://castalian.files.wordpress.com/2009/02/vberror.png"><img style="display:inline;border-width:0;" title="VBError" border="0" alt="VBError" src="http://castalian.files.wordpress.com/2009/02/vberror-thumb.png?w=303&#038;h=295" width="303" height="295" /></a></p>
<h3>C#</h3>
<p><a href="http://castalian.files.wordpress.com/2009/02/csharperror.png"><img style="display:inline;border-width:0;" title="CSharpError" border="0" alt="CSharpError" src="http://castalian.files.wordpress.com/2009/02/csharperror-thumb.png?w=311&#038;h=295" width="311" height="295" /></a></p>
<p>You don’t need to execute your code, the static checker runs a build time which is pretty smart. It is a best practice to always enable runtime checking as well, as the static checker does not always catch every single error, but the real power in this, is that every precondition in the solution is checked.</p>
<p>Change the zero parameter in the constructor thus, and build</p>
<h3>Visual Basic</h3>
<div style="font-family:courier new;background:white;color:black;font-size:10pt;">
<p style="margin:0;">&#160;&#160;&#160; <span style="color:blue;">Sub</span> Main()</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">Dim</span> rational <span style="color:blue;">As</span> <span style="color:blue;">New</span> Rational(3, 4)</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; Console.WriteLine(rational.ToInt())</p>
<p style="margin:0;">&#160;&#160;&#160; <span style="color:blue;">End</span> <span style="color:blue;">Sub</span></p>
</p></div>
<h3>C#</h3>
<div style="font-family:courier new;background:white;color:black;font-size:10pt;">
<p style="margin:0;">&#160;&#160;&#160;&#160; <span style="color:blue;">static</span> <span style="color:blue;">void</span> Main(<span style="color:blue;">string</span>[] args)</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:#2b91af;">Rational</span> rational = <span style="color:blue;">new</span> <span style="color:#2b91af;">Rational</span>(3, 4);</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:#2b91af;">Console</span>.WriteLine(rational.ToInt());&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; } </p>
<p style="margin:0;">
<p>It is still possible for a zero denominator to enter the ToInt() method, even though it appears impossible due to the constructor code. One might have another method in this class or have sub types of this class, and there is nothing to prevent this Rational class from getting a zero denominator even though the class was not created with a zero in the first place. The way one protects the class from this occurring is through an <em>object invariant</em> method.</p>
<p>In the code editor type “cim” and then tab tab – just like adding an event handler (no code snippets yet in the VB editor)</p>
<p><a href="http://castalian.files.wordpress.com/2009/02/contractinvariantmethod.png"><img style="display:inline;border-width:0;" title="ContractInvariantMethod" border="0" alt="ContractInvariantMethod" src="http://castalian.files.wordpress.com/2009/02/contractinvariantmethod-thumb.png?w=592&#038;h=248" width="592" height="248" /></a>&#160;</p>
<h3>Visual Basic</h3>
<div style="font-family:courier new;background:white;color:black;font-size:10pt;">
<p style="margin:0;">&#160;&#160;&#160;&#160; &lt;ContractInvariantMethod()&gt; _</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">Protected</span> <span style="color:blue;">Sub</span> ObjectInvariant()</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Contract.Invariant(<span style="color:blue;">False</span>)</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">End</span> <span style="color:blue;">Sub</span></p>
</p></div>
<h3>C#</h3>
<div style="font-family:courier new;background:white;color:black;font-size:10pt;">
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160; [<span style="color:#2b91af;">ContractInvariantMethod</span>]</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">protected</span> <span style="color:blue;">void</span> ObjectInvariant()</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:#2b91af;">Contract</span>.Invariant(<span style="color:blue;">false</span>);</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
<p style="margin:0;">&#160;</p>
<p style="margin:0;">You can then set the parameter in the method</p>
</p></div>
</p></div>
<h3>Visual Basic</h3>
<div style="font-family:courier new;background:white;color:black;font-size:10pt;">
<div style="font-family:courier new;background:white;color:black;font-size:10pt;">
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;ContractInvariantMethod()&gt; _</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">Protected</span> <span style="color:blue;">Sub</span> ObjectInvariant()</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Contract.Invariant(<span style="color:blue;">Me</span>.denominator &gt; 0)</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">End</span> <span style="color:blue;">Sub</span></p>
</p></div>
</p></div>
<h3>C#</h3>
<div style="font-family:courier new;background:white;color:black;font-size:10pt;">
<p style="margin:0;">&#160;&#160; [<span style="color:#2b91af;">ContractInvariantMethod</span>]</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">protected</span> <span style="color:blue;">void</span> ObjectInvariant()</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:#2b91af;">Contract</span>.Invariant(<span style="color:blue;">this</span>.denominator &gt; 0);</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
<p style="margin:0;">It is now impossible for the denominator in the class to ever be zero. One also want to be able to inform clients of this Rational class what the ToInt() returns, this is the <em>postcondition</em>.</p>
<h3>Visual Basic</h3>
<div style="font-family:courier new;background:white;color:black;font-size:10pt;">
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:green;">&#8216; Method returns the closest integer by truncation</span></p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">Public</span> <span style="color:blue;">Function</span> ToInt() <span style="color:blue;">As</span> <span style="color:blue;">Integer</span></p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Contract.Ensures(Contract.Result(<span style="color:blue;">Of</span> <span style="color:blue;">Integer</span>)() &gt;= 0)</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">Return</span> <span style="color:blue;">Me</span>.numerator / <span style="color:blue;">Me</span>.denominator</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">End</span> <span style="color:blue;">Function</span></p>
<h3>C#</h3>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:green;">// Method returns the closest integer by truncation</span></p>
<div style="font-family:courier new;background:white;color:black;font-size:10pt;">
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">public</span> <span style="color:blue;">int</span> ToInt()</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:#2b91af;">Contract</span>.Ensures(<span style="color:#2b91af;">Contract</span>.Result&lt;<span style="color:blue;">int</span>&gt;() &gt;= 0);</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">return</span> <span style="color:blue;">this</span>.numerator / <span style="color:blue;">this</span>.denominator;</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
</p></div>
</p></div>
</p></div>
<p>The thing to notice here is that the Contract.Ensures method is declared before the integer is returned, but the compiler (magic) rearranges the code so this code is called after the integer has been returned back. I will now show the completed projects showing <em>preconditions</em>, <em>object</em> <em>invariants</em> and <em>postconditions.</em></p>
<h3>Visual Basic</h3>
<div style="font-family:courier new;background:white;color:black;font-size:10pt;">
<p style="margin:0;"><span style="color:blue;">Imports</span> System.Diagnostics.Contracts</p>
<p style="margin:0;">&#160;</p>
<p style="margin:0;"><span style="color:blue;">Module</span> Module1</p>
<p style="margin:0;">&#160;&#160;&#160; <span style="color:green;">&#8216; Simple class to represent rational numbers</span></p>
<p style="margin:0;">&#160;&#160;&#160; <span style="color:blue;">Public</span> <span style="color:blue;">Class</span> Rational</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">Private</span> numerator <span style="color:blue;">As</span> <span style="color:blue;">Integer</span></p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">Private</span> denominator <span style="color:blue;">As</span> <span style="color:blue;">Integer</span></p>
<p style="margin:0;">&#160;</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">Public</span> <span style="color:blue;">Sub</span> <span style="color:blue;">New</span>(<span style="color:blue;">ByVal</span> numerator <span style="color:blue;">As</span> <span style="color:blue;">Integer</span>, <span style="color:blue;">ByVal</span> denominator <span style="color:blue;">As</span> <span style="color:blue;">Integer</span>)</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Contract.Requires(0 &lt; denominator)</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Contract.Requires(0 &lt;= numerator)</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">Me</span>.numerator = numerator</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">Me</span>.denominator = denominator</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">End</span> <span style="color:blue;">Sub</span></p>
<p style="margin:0;">&#160;</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;ContractInvariantMethod()&gt; _</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">Protected</span> <span style="color:blue;">Sub</span> ObjectInvariant()</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Contract.Invariant(<span style="color:blue;">Me</span>.denominator &gt; 0)</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Contract.Invariant(<span style="color:blue;">Me</span>.numerator &gt;= 0)</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">End</span> <span style="color:blue;">Sub</span></p>
<p style="margin:0;">&#160;</p>
<p style="margin:0;">&#160;</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:green;">&#8216; Method returns the closest integer by truncation</span></p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">Public</span> <span style="color:blue;">Function</span> ToInt() <span style="color:blue;">As</span> <span style="color:blue;">Integer</span></p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Contract.Ensures(Contract.Result(<span style="color:blue;">Of</span> <span style="color:blue;">Integer</span>)() &gt;= 0)</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">Return</span> <span style="color:blue;">Me</span>.numerator / <span style="color:blue;">Me</span>.denominator</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">End</span> <span style="color:blue;">Function</span></p>
<p style="margin:0;">&#160;</p>
<p style="margin:0;">&#160;&#160;&#160; <span style="color:blue;">End</span> <span style="color:blue;">Class</span></p>
<p style="margin:0;">&#160;</p>
<p style="margin:0;">&#160;&#160;&#160; <span style="color:blue;">Sub</span> Main()</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">Dim</span> rational <span style="color:blue;">As</span> <span style="color:blue;">New</span> Rational(12, 3)</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; Console.WriteLine(rational.ToInt())</p>
<p style="margin:0;">&#160;&#160;&#160; <span style="color:blue;">End</span> <span style="color:blue;">Sub</span></p>
<p style="margin:0;">&#160;</p>
<p style="margin:0;"><span style="color:blue;">End</span> <span style="color:blue;">Module</span></p>
</p></div>
<h3>C#</h3>
<div style="font-family:courier new;background:white;color:black;font-size:10pt;">
<p style="margin:0;"><span style="color:blue;">using</span> System;</p>
<p style="margin:0;"><span style="color:blue;">using</span> System.Diagnostics.Contracts;</p>
<p style="margin:0;">&#160;</p>
<p style="margin:0;"><span style="color:blue;">namespace</span> CodeContractsDemo</p>
<p style="margin:0;">{</p>
<p style="margin:0;">&#160;&#160; <span style="color:green;">// Simple class to represent rational numbers</span></p>
<p style="margin:0;">&#160;&#160;&#160; <span style="color:blue;">public</span> <span style="color:blue;">class</span> <span style="color:#2b91af;">Rational</span></p>
<p style="margin:0;">&#160;&#160;&#160; {</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">int</span> numerator;</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">int</span> denominator;</p>
<p style="margin:0;">&#160;</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">public</span> Rational(<span style="color:blue;">int</span> numerator, <span style="color:blue;">int</span> denominator)</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:#2b91af;">Contract</span>.Requires(0 &lt; denominator);</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:#2b91af;">Contract</span>.Requires(0 &lt;= numerator);</p>
<p style="margin:0;">&#160;</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">this</span>.numerator = numerator;</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">this</span>.denominator = denominator;</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
<p style="margin:0;">&#160;</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; [<span style="color:#2b91af;">ContractInvariantMethod</span>]</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">protected</span> <span style="color:blue;">void</span> ObjectInvariant()</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:#2b91af;">Contract</span>.Invariant(<span style="color:blue;">this</span>.denominator &gt; 0);</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:#2b91af;">Contract</span>.Invariant(<span style="color:blue;">this</span>.numerator &gt;= 0);</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
<p style="margin:0;">&#160;</p>
<p style="margin:0;">&#160;</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:green;">// Method returns the closest integer by truncation</span></p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">public</span> <span style="color:blue;">int</span> ToInt()</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:#2b91af;">Contract</span>.Ensures(<span style="color:#2b91af;">Contract</span>.Result&lt;<span style="color:blue;">int</span>&gt;() &gt;= 0);</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">return</span> <span style="color:blue;">this</span>.numerator / <span style="color:blue;">this</span>.denominator;</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
<p style="margin:0;">&#160;</p>
<p style="margin:0;">&#160;&#160;&#160; }</p>
<p style="margin:0;">&#160;&#160;&#160; <span style="color:blue;">class</span> <span style="color:#2b91af;">Program</span></p>
<p style="margin:0;">&#160;&#160;&#160; {</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue;">static</span> <span style="color:blue;">void</span> Main(<span style="color:blue;">string</span>[] args)</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:#2b91af;">Rational</span> rational = <span style="color:blue;">new</span> <span style="color:#2b91af;">Rational</span>(12,3);</p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:#2b91af;">Console</span>.WriteLine(rational.ToInt());&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p>
<p style="margin:0;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
<p style="margin:0;">&#160;&#160;&#160; }</p>
<p style="margin:0;">}</p>
<p style="margin:0;">&#160;</p>
<p style="margin:0;">I am sure one can be certain that you be seeing a lot more of this type of .NET code in the not too distant future.</p>
</p></div>
<br />Posted in Code Contracts  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/castalian.wordpress.com/725/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/castalian.wordpress.com/725/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/castalian.wordpress.com/725/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/castalian.wordpress.com/725/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/castalian.wordpress.com/725/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/castalian.wordpress.com/725/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/castalian.wordpress.com/725/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/castalian.wordpress.com/725/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/castalian.wordpress.com/725/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/castalian.wordpress.com/725/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/castalian.wordpress.com/725/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/castalian.wordpress.com/725/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/castalian.wordpress.com/725/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/castalian.wordpress.com/725/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lukhezo.com&amp;blog=2467070&amp;post=725&amp;subd=castalian&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lukhezo.com/2009/02/25/code-contracts-forthcoming-in-net-40/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">castalian</media:title>
		</media:content>

		<media:content url="http://castalian.files.wordpress.com/2009/02/overflowexception-thumb.png" medium="image">
			<media:title type="html">OverflowException</media:title>
		</media:content>

		<media:content url="http://castalian.files.wordpress.com/2009/02/dividebyzeroexception-thumb.png" medium="image">
			<media:title type="html">DivideByZeroException</media:title>
		</media:content>

		<media:content url="http://castalian.files.wordpress.com/2009/02/contractslibrary-thumb.png" medium="image">
			<media:title type="html">ContractsLibrary</media:title>
		</media:content>

		<media:content url="http://castalian.files.wordpress.com/2009/02/visualstudio-thumb.png" medium="image">
			<media:title type="html">VisualStudio</media:title>
		</media:content>

		<media:content url="http://castalian.files.wordpress.com/2009/02/precondition-thumb.png" medium="image">
			<media:title type="html">PreCondition</media:title>
		</media:content>

		<media:content url="http://castalian.files.wordpress.com/2009/02/staticaswell-thumb.png" medium="image">
			<media:title type="html">StaticAsWell</media:title>
		</media:content>

		<media:content url="http://castalian.files.wordpress.com/2009/02/vberror-thumb.png" medium="image">
			<media:title type="html">VBError</media:title>
		</media:content>

		<media:content url="http://castalian.files.wordpress.com/2009/02/csharperror-thumb.png" medium="image">
			<media:title type="html">CSharpError</media:title>
		</media:content>

		<media:content url="http://castalian.files.wordpress.com/2009/02/contractinvariantmethod-thumb.png" medium="image">
			<media:title type="html">ContractInvariantMethod</media:title>
		</media:content>
	</item>
		<item>
		<title>Spec#, a new dawn for programming languages</title>
		<link>http://lukhezo.com/2008/05/29/f-a-new-dawn-for-programming/</link>
		<comments>http://lukhezo.com/2008/05/29/f-a-new-dawn-for-programming/#comments</comments>
		<pubDate>Thu, 29 May 2008 11:24:58 +0000</pubDate>
		<dc:creator>Ira Lukhezo</dc:creator>
				<category><![CDATA[Patterns & Practices]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://castalian.wordpress.com/2008/05/29/f-a-new-dawn-for-programming/</guid>
		<description><![CDATA[Spec# pronounced &#8216;Spec Sharp&#8217; is new attempt at a more cost effective way to develop and maintain high-quality software. This language is being developed by Microsoft Research and has left me completely dumbstruck. My favourite programming language is C# of which I&#8217;m self taught, but I was formally trained in C/C++. Spec# is an extension [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lukhezo.com&amp;blog=2467070&amp;post=60&amp;subd=castalian&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Spec# pronounced &#8216;Spec Sharp&#8217; is new attempt at a more cost effective way to develop and maintain high-quality software. This language is being developed by <a href="http://research.microsoft.com/specsharp/">Microsoft Research</a> and has left me <em>completely</em> dumbstruck. My favourite programming language is <a href="http://en.wikipedia.org/wiki/C_Sharp_%28programming_language%29">C#</a> of which I&#8217;m self taught, but I was formally trained in C/C++.</p>
<p>Spec# is an extension to C# that introduces the notion of contract based programming. If you have tried Windows Communication Foundation, you will be familiar with the notion of contracts. Spec# takes things to a whole new level, and is very very <em>explicit</em> &#8211; this is a complete understatement by the way.</p>
<p>When you are defining your encapsulated fields and methods you have to go into a great more detail about how those fields and methods will operate, all at <em>compile</em> time. In C++, C# or Visual Basic, a developer usually writes a chunk of code and then compiles that code into a .dll or executable. It is only at this stage when problems are identified, and resolutions are effected. Spec# does not allow this because as you write your code it checks everything. One of the key features is that you have to specify values as non-null. This is a big deal.</p>
<p>What non-null stipulations allow for, is very <em>performant</em> code (&#8216;performant&#8217; is a word used by <a href="http://www.microsoft.com/presspass/exec/techfellow/default.mspx">Technical Fellows</a> so it is now a word &#8211; as far as I am concerned). This is because code is not being checked for being null which is something that is always done for <a href="http://msdn.microsoft.com/en-us/library/8bs2ecf4(VS.71).aspx">Common Language Runtime</a> languages. The way the Spec# team achieve this is through their &#8216;brain-box&#8217; knowledge of <a href="http://en.wikipedia.org/wiki/Common_Intermediate_Language">Microsoft Intermediate Language</a>.</p>
<p>I will certainly be keeping my eyes on this one.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/castalian.wordpress.com/60/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/castalian.wordpress.com/60/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/castalian.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/castalian.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/castalian.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/castalian.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/castalian.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/castalian.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/castalian.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/castalian.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/castalian.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/castalian.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/castalian.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/castalian.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/castalian.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/castalian.wordpress.com/60/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lukhezo.com&amp;blog=2467070&amp;post=60&amp;subd=castalian&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lukhezo.com/2008/05/29/f-a-new-dawn-for-programming/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">castalian</media:title>
		</media:content>
	</item>
	</channel>
</rss>
