Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Design by contract
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Approach for designing software}} [[File:Design by contract.svg|thumbnail|A design by contract scheme]] '''Design by contract''' ('''DbC'''), also known as '''contract programming''', '''programming by contract''' and '''design-by-contract programming''', is an approach for [[software design|designing software]]. It prescribes that software designers should define [[Formal methods|formal]], precise and verifiable interface specifications for [[Component-based software engineering#Software component|software components]], which extend the ordinary definition of [[abstract data type]]s with [[precondition]]s, [[postcondition]]s and [[Invariant (computer science)|invariants]]. These specifications are referred to as "contracts", in accordance with a [[conceptual metaphor]] with the conditions and obligations of business contracts. The DbC approach [[Offensive_programming|assumes]] all ''client components'' that invoke an operation on a ''server component'' will meet the preconditions specified as required for that operation. Where this assumption is considered too risky (as in multi-channel or [[distributed computing]]), the [[defensive_programming|inverse approach]] is taken, meaning that the ''server component'' tests that all relevant preconditions hold true (before, or while, processing the ''client component'''s request) and replies with a suitable error message if not.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)