Trying out Code Contracts from Microsoft Research
There are two sections that get added to VS 2008 after you install the add-in from MSR to test Code Contracts. The first one is simply called 'Contracts'.
The second tab is named 'Code Contracts'.
The MSR team did a presentation at PDC08 about Code Contracts and the Pex automated-testing tool.
In the area of contract-based coding at Microsoft, there is also Spec#. Sample shown below.
using System;
using Microsoft.Contracts;
public class Program
{
static void Main(string![]! args)
{
Console.WriteLine("Spec# says hello!");
}
public int Add(int i, int j)
requires i > 5;
requires j < 3;
{
int r = i + j;
return r;
}
}
Have you had time to look at contract-based coding? What do you think about it?
Comments
- Anonymous
December 27, 2008
PingBack from http://www.codedstyle.com/trying-out-code-contracts-from-microsoft-research/