Spec# In For SharePoint Development (DbC)

In previous posts, I ranted about the benefits of using design by contract (DbC) programming, and its benefits. In the post we discussed some very interesting things about DbC, and explored some of the benefits that we get by implementing this paradigm with something as simple as the properties that are being exposed by a WebPart.

I have received some questions regarding if I used straight C# programming, or if I used other frameworks to achieve DbC programming while I was doing general SharePoint development. The answer to this, is no, sometimes I don’t, however sometimes I do. To be honest, I have begun to use Spec# for pretty much all of my development, and have been for about 3/4 of a year now, or so.

Although I will be writing about Spec# in later posts more intensively, it is a fantastic framework for developing contract based applications and I am in love with its possibility of using object invariants. Spec# also has the facilities built in by which exception handling has Exception safety (checked exceptions) and finally provides the type system with no-null types. Most importantly, in whatever piece of documentation you read about Spec#, you will notice the word contract! It is perfect for DbC programming :-)

Anyways, I will shortly be posting a three part series in how one can use Spec# for their SharePoint development, where we do a simple console application, demonstrating how using it will increase the quality of the software that you are developing as well as cutting down on the time in redundant tasks.