vesuvius said:exoteric said:*snip*
(to add to Exo) You can use the devlabs contracts, but sadly - presently at least - code contracts will not gain traction, consequent to the full features being only available to Visual Studio Team System.
Apparently Microsoft think that only Visual Studio team system developers want to build robust code - the rest of us like creating leaky code full of null checks. If you have the time or willingness then please vote at connect.
If you really want to understand code contracts, then Charles has one of my favorite ever interviews going on about sleeping barbers on Channel 9 with Bertrand Meyer. It's ad-hoc, unscripted and deeply enlightening. Make you see just how slow the world of programming tends to really move, and what the result of being passionate about something (like contracts) results in.
Eiffel is adding null-safety to the language (called void-safety in Eiffel), see this paper
I also don't like having contracts everywhere saying requires(x != null) for example.
I'd rather like to see Nullable<Employee> and statically enforce consuming code to check for nullness before consuming the value - like staticaly enforcing pattern matching on ADTs.