A new Microsoft design approach called Code Contracts for .NET allows developers to write 'contracts' describing the interfaces and behavior of code segments, defining their roles and relationships with other bits of software.Microsoft has implemented the design-by-contract approach to
software development for .NET developers.
In a solution called Code Contracts for .NET, which came out of
Microsoft Research, Microsoft is providing a design-by-contract,
mechanism for .NET programmers to use.
Design by Contract (DbC) is an approach to designing that proposes
that software designers should define formal, precise and verifiable
interface specifications for software components based upon the theory
of abstract data types and the conceptual metaphor of a business
contract. In other words, the basic idea is that software components
can define "contracts" about their behavior, inputs, state change and
other things. The term was coined by Bertrand Meyer, creator of the
Eiffel programming language.
In a blog post, Microsoft Senior Vice President, Developer Division, S. Somasegar said
Microsoft's Dev Labs released Code Contracts for .NET to enable
programmers "to provide method preconditions and postconditions that
enrich existing APIs with information that is not expressible in the
type systems of .NET languages. Additionally, contracts specify object
invariants, which define what allowable states an instance of a class
may be in (i.e. its internal consistency)."
Read the rest of this article on eWEEK.com.