Design by Contract for C#

If the propeller on your beanie has slowed down and you need a little geekifying, try checking out Spec#. It’s an extension of C# that supports Design by Contract (or Programming by Contract for the litigious). You know — preconditions, postconditions, invariants, side effects.

For alternative views into DbC for C#, you might check out XC#, although it looks like it might be abandonware. Plus they use that weird “my word has an X in it so I’ll use that in the acronym” thing.

My own take: Spec# looks forbiddingly complex. I personally believe spending the extra time writing unit tests would not only wed the code to the contract(s), but also helps iteratively flesh out the design (“design a little, code a little“), which to my mind is just as beneficial.

Advertisements

0 Responses to “Design by Contract for C#”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s





%d bloggers like this: