On Wednesday, February 17, 2010, I gave a 90 minute presentation to the Minnesota Visual Studio User Group, on the use of Microsoft Code Contracts to improve software quality. Approximately 17 programmers attended. I used several Visual Studio solutions and several PowerPoint presentations. All of the materials can be downloaded from my download section. In addition, I have summarized several of the questions that were asked by the participants. For each question, I have included the answer that I gave them, as well as additional thoughts I had after further reflection. If any of you are giving presentations on the topic of code contracts, feel free to use any of the slides or sample code.
Question:
You have demonstrated how to use a precondition. But I don’t see why I shouldn’t simply use my traditional “if(x) then (do y)” statement to validate arguments.