code-contracts
Design by Contract: Can we express Stack FILO property with contract?
It seems that design by contract has limit to express specification. For example, i tried to express Stack FILO property with contract, but didn\'t get an idea. Anybody can help?[详细]
2023-01-24 06:57 分类:问答Specify code contract on Func<T> parameters?
Say I have the following public T Exam开发者_如何学JAVAple(Func<T> f) { Contract.Requires(f != null);[详细]
2023-01-22 23:11 分类:问答Programming by contracts in PHP
Programming by contracts is a modern trend in .NET, but what about libraries/frameworks for code contracts in PHP? What do you think about applicability of this paradigm for PHP?[详细]
2023-01-22 03:53 分类:问答Create code contracts for a legacy library
The ultimate goal is to specify contracts for a class that resides in an external assembly that I don\'t have control over (i.e. I cannot just add contracts to that class directly).[详细]
2023-01-21 18:18 分类:问答How to tell the static checker that a property never changes when it is unprovable?
My class has a property that is initialized in the constructor and is never supposed to change. Methods all around my codebase accept that class as a parameter and rely on that property satisfying a c[详细]
2023-01-20 15:38 分类:问答How can I specify code contracts for existing framework (BCL) code?
Code contracts work great until you have to add a bazillion Contract.Assume(...) for the results coming out of framework code. For instance, MemoryStream.ToArray() never returns a null array, as best[详细]
2023-01-19 22:09 分类:问答Collection Contracts and Threading
Suppose I have a custom collection class that provides some internal thread synchronization.For instance, a simplified Add method might look like this:[详细]
2023-01-19 11:27 分类:问答Has someone experiences with metrics for Design-By-Contract or can recommend metrics to measure the usage of Design-By-Contract in a code base?
We are currently introducing Design-by-Contract to a software development group of about 60 developers, which are developing different components. We started by defining Design-By-Contract policies fo[详细]
2023-01-16 15:42 分类:问答Static verification limitations when using pure functions in C# code contracts?
I\'m trying to statically verify the following partial implementation of an array-based stack with code contracts. The method Pop() uses the pure function IsNotEmpty() to ensure that the subsequent ar[详细]
2023-01-16 07:59 分类:问答Ensures Unproven via property when implementing interface
I\'m trying what, to me, seems like some fairly basic code contracts code. I\'ve reduced it down to the following problem. The following fails the static analysis, with the message[详细]
2023-01-16 05:03 分类:问答