views:

57

answers:

1

I am looking at using design by contract for a personal project in C# using .NET 4.

I have been reading about Microsoft's attempt at a design by contract framework: http://msdn.microsoft.com/en-us/devlabs/dd491992.aspx

But there are many alternatives and I'm baffled - so which is the best and why? What are the pros and cons of each?

+2  A: 

Are there really many alternatives? I haven't heard of many. There are other AOP frameworks, and there are things like Spec#, but I haven't come across many projects quite like Code Contracts.

Given that it's under active development by Microsoft, integrated into Visual Studio, with the core contract classes as part of .NET 4, I'd go with that unless you have a really compelling reason to use an alternative.

To me the biggest downside of Code Contracts is that the static checker is only available with Visual Studio Premium/Ultimate.

Jon Skeet
Well there is this one: http://www.codeproject.com/KB/cs/designbycontract.aspx but you are right about the VS integration. I'll give it a try
rmx