Thursday, August 14, 2008

Spec# – Contracts in C#

It looks like the research project Spec# that Microsoft has been working is available to download and play with. Obviously I am behind on the times as this stuff looks like it has been available for some time.

http://research.microsoft.com/SpecSharp/

From what I understand from feedback form the ALT.NET event in Seattle and the channel 9 videos (http://channel9.msdn.com/shows/Going+Deep/Expert-to-Expert-Contract-Oriented-Programming-and-Spec/ & http://channel9.msdn.com/forums/Coffeehouse/226756-Using-Spec-in-VS-2005/), Spec# aims to provide us with compile time verification of what constitutes a method or class contract. Just as the shift from VB to .NET meant I had access to a strongly typed world, the shift Spec# looks to offer is further verification on a class or method contract. At a basic level this gives verification on null parameters and some contractual awareness of exceptions.

I doubt there is any production value in what spec# provides at the moment, but is worth keeping an eye on as the expectation of reliable and durable software keeps increasing.

1 comment:

RhysC said...

eattle it appears that
A) Spec# is based on .net 2.0, so new cool feature dont work well with it
B) its a research project so is not for commerical release
C) you can remove the spec#ness from your code by using "comment like" tags in the same way you can have debug sections so non spec sharp assemblies can still understand it (from memory)

Would be great to see this in the next release on .net. I think its a huge benefit.