Design by contract (DbC) prescribes that software designers should define formal, precise and verifiable interface specifications for software components, which extend the ordinary definition of abstract data types with preconditions, postconditions and invariants.

learn more… | top users | synonyms

2
votes
2answers
135 views

How are design-by-contract and property-based testing (QuickCheck) related?

Is their only similarity the fact that they are not xUnit (or more precisely, not based on enumerating specific test cases), or is it deeper than that? Property-based testing (using QuickCheck, ...
1
vote
4answers
91 views

Does design by contract imply correct output?

Design by Contract says, in terms of the function talking: "you give me all the right parameters and I'll give you exactly this kind of data" ...in essence. So, given that, should I use up resources ...
3
votes
1answer
150 views

Advantages of contracts over assert statements

Today I stumbled upon the python package called PyContracts. However, python has the assert statement which seems to allow you to do exactly those things. What advantages do contracts have over assert ...
1
vote
1answer
58 views

Alternatives to JDT Annotation - License issues

I have used the JDT Annotation library in my Java project as I am quite fond of what it offers. To be more exact, I used the @Nullable and @NonNullByDefault annotations as I can use the synergy with ...
3
votes
3answers
159 views

What is the difference between dependent typing and contracts?

What is the difference between dependent typed languages and languages like Spec# and Eiffel that allow you to specify "contracts" for functions in your code for pre/postconditions? Is dependent ...
5
votes
2answers
418 views

Earliest use of Comments as Semantically Meaningful Things in a Program?

In certain corners of the PHP meta-programming world, it's become fashionable to use PHPDoc comments as a mechanism for providing semantically meaningful information to a program. That is, other code ...
2
votes
0answers
106 views

Is there any static analyzer for code contracts for Java 1.6?

I have used Java Modeling Language (JML) with its runtime assertion checker jml4c for writing code contracts in java. However, it would have been great to have a static checker in place as well that ...
3
votes
2answers
242 views

Why is design by contract considered an alternative to the pseudo programming process?

Right now I'm reading Code Complete by Steve McConnell and in chapter 9 he talks about the Pseudo Programming Process (PPP). From what I've understood, the PPP is a way of programming in which the ...
4
votes
2answers
478 views

Options for programming by contract in Java

I am working on a project (which includes JavaEE web apps and JavaSE apps) that has grown from a single developer to a team of three, and issues of readability and robustness are starting to emerge. ...
5
votes
3answers
816 views

Checking preconditions or not

I've been wanting to find a solid answer to the question of whether or not to have runtime checks to validate input for the purposes of ensuring a client has stuck to their end of the agreement in ...
17
votes
10answers
4k views

Should a method validate its parameters? [duplicate]

Say you are designing a Square root method sqrt. Do you prefer to validate the parameter passed is not a negative number or do you leave it up to the caller to make sure the param passed is valid. How ...