Coincidences, assertions and code contracts

I ran into the language/sorting coincidence not too long ago, and now I read the Introduction to Code Contracts post, which look like a much more sophisticated, structured and toolable tool than the simple Debug.Assert calls we have these days.

Code contracts, by the way, are based on work from Microsoft Research. A big shout out to Nikolai Tillmann, in case he remembers me from the days when we discussed testing stacks and text editors far many, many years ago.

And finally, no post about code analysis tools should fail to mention our beloved FxCop, now with MSDN documentation. Remember you can write custom rules - a great place to start is the posts on Custom Rules from the Code Analysis blog.

I remember writing a few internal rules when working on ADO.NET Data Services, which did things like checking whether we used the DataServiceException constructors that take an HTTP status code. Integrate your own rules with your check-in process, combine with consistent and healthy error checking and assertions, and you've just raised the bar forevermore 🙂


Comments (0)

Skip to main content