views:

335

answers:

2

Can someone explain the concepts that Spec# might be moving into C# 4.0, regarding Code Contracts?

  • What are code contracts (Looks to be a compile time checking pattern)
  • should I be excited about this?
  • Am I correct in assuming that we move what would be runtime checks to compile time?

Thanks!

+2  A: 

Here's a good description of code contracts straight from Microsoft Research. It sounds like the main benefits are:

  • Improved testability
  • Static verification
  • API documentation (in code)
Marc Novakowski
+3  A: 

I personally am a big fan of a guy called Bertrand Meyer who wrote this book called Object Oriented Software Contruction and created a language called Eiffel which endoreses Design By Contract or Contract based programming.

  1. Code Contract is a kind of agreement between 2 software entities that may or may not interact. More or less like interfaces but more precise.
  2. I am not sure if everyone should or would be excited about this.
  3. Your assumption is somewhat correct.

You might want to see this series of videos link

Perpetualcoder