Questions tagged [design-by-contract]
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.
30 questions
4 votes
4 answers
813 views
Is design by contract useful without unit testing?
I read Bertrand Meyer's paper on design by contract yesterday and it is not very clear for me what is the relationship between DbC and testing, since it appears that without testing I cannot be ...
-2 votes
1 answer
76 views
How do you enforce API contracts across mutliple stacks?
For systems that are built on top of diverse tech stacks, including both static and dynamic types languages, what is in practice some ways to have the API contracts published and enforced? Some wiki ...
0 votes
1 answer
131 views
API DESIGN: Store Table of function pointers in client or dynamically in api service
FIRST AND FOREMOST: Forgive me if the following question falls into the "off topic" category of this StackExchange, due to its slightly opinion polling nature. This is not my intention, I am simply ...
6 votes
6 answers
2k views
Should I assert the preconditions of functions in a public API?
I am writing a library for some data structures in C that will be used in embedded systems. I have had issues designing and coming up with a solid error handling plan. This API is only subject to ...
2 votes
0 answers
231 views
Are there issues in using Design by Contract effectively within the typical software development process? [closed]
I'm in the early stages of learning design-by-contract (DbC). And I think that if followed correctly, it can produce very high quality software. This gets me wondering though... why isn't it used a ...
4 votes
1 answer
2k views
Is Design by Contract the same as using Interfaces to create a "contract"?
Does an OOP design that uses a Design by Contract mean the designer is using interfaces to create a "contract." The term "contract" is used quite often when discussing OOP interfaces, so I didn't ...
4 votes
3 answers
967 views
In design by contract, why preconditions should be ensured by a client and postconditions - by a supplier?
I'd heard about Design by Contract a long time ago and always was confused by this question. The approach uses real-world client-supplier analogy to describe caller-callee relationships. It stays, ...
3 votes
1 answer
190 views
What makes design by contract a tool?
Design by contract is based on Hoare logic where a proof of correctness of a program is established by reasoning over pre/post conditions and invariants. What are the means and prerequisites of a ...