Code Contracts - Introduced by Microsoft Reseach which claims to provide more readability to you code by making it more clean. One very easy to follow article is here where you can learn how to use Code Contracts in you code:

Well, fair enough! Looks good. Pre/Post Conditional Validations, Static/Runtime Checking... Good stuff // Huh....

Now lets get into the shoes of an enterprise developer who is working on ASP.NET 2.0 application. He reads through this article, thanks me for pointing him to this and then will he ever implement it in his code base?

NO. He flips this idea like a no brainer becuase:

1. He is more into maintenance and the code is already written. The things that we are trying to achieve with Code Contracts, the previous coder has already achieved using manual validations etc.

2. He has to change a lot many things. First - get the code contracts enabled then get the team in agreement to use them.

However - if he is building something new, he would like to use Code Contracts to a more meaningful programming.

So - Where do I use Code Contracts?

1. To enforce the business rules
2. To make your code more robust and testable