Michael Perry states in his Pluralsight course on Provable Code (transcript subscription only) that:[T]he burden of proof rests with the callerIn a code contract, why must the burden of proof rest with the caller and not the method of the class that is being called? Is this a preferred convention or does it have a more solid basis? At the moment it just like a dogma to me as the class being called could make its own safety checks, which would reduce calling code duplication.
Why must the burden of proof rest with the caller and not the method of the class that is being called?
code contracts
I'd say that burden of proof is the wrong way to think about it. A class with a calling contract can and should validate that the contract is kept by callers. But when it's not, all it can do is produce an error/exception. The point of the contract is to state clearly  what the calling code must do to produce a correctly working program, so that there are no errors/exceptions. When a code contract is not kept, that's a programming error. Making the contract explicit helps you to avoid the error.If you're serious about code contracts, you want a language where they are enforced by the compiler as much as possible.