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

0
votes
0answers
47 views

Design by Contract and Defensive Programming Confusion [duplicate]

I have been interested in better coding practices/methods which makes the reliability and maintenance less painful effort. I read the chapter about Design by Contract on "Object Oriented Software ...
0
votes
3answers
63 views

Defining resource allocation in method documentation

I want to write a library with "no resource leak guarantee" feature. So I shall know whether each method allocates any resource or not. It may change the code. For example: void foo() { ...
1
vote
4answers
96 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 ...
1
vote
1answer
80 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
1answer
212 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 ...
3
votes
3answers
199 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
423 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
2answers
203 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, ...
3
votes
2answers
288 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
516 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. ...
6
votes
3answers
1k 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 ...
18
votes
10answers
6k 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 ...