design-by-contract

What does Check.Assert(), Check.Ensure(), and Check.Require() do?

Please tell me what those functions do. ...

How can I write a contract for an abstract method?

I am using contracts in my Java project. (Contract = doing checks at the start and end of methods) I am wondering if there is a nice way/pattern to write a contract for a generic method. For example: public abstract class AbstractStringGenerator{ /** * This method must return a new line as it's last char * @return string ...

eXtreme Design-by-Contract with Java, other than XINS?

Are there any technical Design-by-Contract solutions for Java projects similar to XINS? I'm looking for projects/frameworks that enforce developers to first author a contract for their application and then code within the boundaries of that contract, really using the contract to the full potential. I'm looking for something that, like XI...

Argument Exceptions should be Unit Tested?

I know this question is pretty similar to others that have been posted before but I would like to discuss this topic in a proper way. Do you think that the "obvious" exception should be unit tested? With obvious exception I mean for example exceptions due to null arguments or empty strings or negative numbers in situations where we the...

why interfaces in dynamic/loosely-typed languages?

I work in php, and the concept of interfaces seems to me a little useless here. From reading, I understand that interfaces are part of "design by contract", but without at least guaranteeing a return of a type of a particular kind, there really isn't any contract. It seems it's like a contract that reads, "We agree to do the following: '...

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 for C# and Java. To measure the progress we are counting the number of classes and the number of contract assertions (Preconditions, post con...

Design By Contract LIbrary(ies) for Common Lisp?

Coming from a background in Clojure, I am taken with the potential that its pre-/post-conditions provide as a basis for design by contract: ;; sqr.clj (defn sqr [n] {:pre [(not= 0 n) (number? n)] :post [(pos? %) (number? %)]} (* n n)) (sqr 10) ;=> 100 (sqr 0) ; Assertion error Is there a similar pre/post capability in Commo...

Design by contract tools for actionscript

Are there tools for AS-3, like iContract for Java, which can help in Design by Contract(DBC)? (Drawing inspiration from The Pragmattic Programmer). ...

How to enforce interface contracts (in C) at compile time?

Background: We're modeling the firmware for a new embedded system. Currently the firmware is being modeled in UML, but the code generation capabilities of the UML modeling tool will not be used. Target language will be C (C99, to be specific). Low power (i.e. performance, quick execution) and correctness are important, but correctnes...

How to define IEnumerable behavior by contract?

Consider this 2 methods that returns IEnumerable: private IEnumerable<MyClass> GetYieldResult(int qtResult) { for (int i = 0; i < qtResult; i++) { count++; yield return new MyClass() { Id = i+1 }; } } private IEnumerable<MyClass> GetNonYieldResult(int qtResult) { ...