3 ms·
I just installed Visual Studio 2010, now how do I get Code Contracts?
- osipov 17y agoMaybe it's just me but I thought that meant "I just installed Visual Studio 2010, now how do I make money?"
- krmmalik 17y agoMe too!!
- lincolnq 17y agoInteresting. The capitalization on "Code Contracts" (as opposed to "code contracts") suggests to me that it's a proper noun, and your interpretation didn't occur to me until I read the comments. Since you've been upvoted many times, a lot of people seem to agree with you. Is English your native language? This seems to be the sort of thing that non-native speakers might miss, but I don't really know.
- warfangle 17y agoCode Contracts seem rather silly. C#/VB is statically typed, no? Method contracts should be implicit in the method declaration, then. Granted, this gives you more control over what literal values may be passed to a method. But isn't that (part of) what exceptions are for? What additional value do these add?
- lincolnq 17y agoIt looks like a fairly powerful static analysis framework, well beyond what the C# type system can prove. Not sure what exactly it can do, but the static checker dialog box allows you to enable: Implicit Non-Null Obligations Implicit Arithmetic Obligations Implicit Array Bounds Obligations Redundant Assumptions If it can do a good job of checking these statically, I'm impressed!
- viggity 17y agoThe big advantage to code contracts is that they prevent null reference exceptions at compile time. Catching potential problems at compile time via static checking is preferable than throwing an exception at runtime. Your code is more resilient to bad data. Having a formal checking mechanisms like code contracts also helps tools like Pex generate better sets of test inputs for automated unit testing.
- yread 17y agoI hope it is at least as good as Spec# http://research.microsoft.com/en-us/projects/specsharp/ http://research.microsoft.com/en-us/projects/specsharp/
- torial 17y agoOr at least comparable to what the Cobra language has for contract support: http://cobra-language.com/docs/quality/ http://cobra-language.com/docs/quality/