Design by Contract
Version 1.0.0 · Updated 2026-07-28
CORE DEFINITION
Design by Contract (DbC) is a method for designing computer software. This method requires software designers to define formal, precise, and verifiable interfaces for software components, thus adding preconditions, postconditions, and invariants to traditional abstract data types. The term 'contract' used in this method's name is a metaphor, as it is somewhat analogous to a commercial contract. Because 'Design by Contract' is a registered trademark of Eiffel Software, many developers use the terms 'Programming by Contract', 'Contract Programming', or 'Contract-First development' to refer to this method. Microsoft also adopts this design approach, calling it 'Code Contracts'.
SCAFFOLDING EFFECT
Reduce cognitive load
Design by Contract (DbC) is a method for designing computer software. This method requires software designers to define formal, precise, and verifiable interfaces for software components, thus adding preconditions, postconditions, and invariants to traditional abstract data types. The term 'contract' used in this method's name is a metaphor, as it is somewhat analogous to a commercial contract.
Anchor fast decisions
A software design method proposed by Bertrand Meyer: it treats interactions between modules as contracts—preconditions, postconditions, and class invariants. The mechanism uses formal agreements to constrain the caller and the callee, and reports an error when a contract is violated.
MINIMUM ACTION
In progress 0/1Practice this model in one real situation:
account_treeGenealogyexpand_more
menu_bookReferencesexpand_more
Source support: Explicit
- zh.wikipedia.orghttps://zh.wikipedia.org/wiki/%E5%A5%91%E7%BA%A6%E5%BC%8F%E8%AE%BE%E8%AE%A1verified
PRIVATE NOTES · Only visible to you
SAVED Q&A
ENTRY Q&A · Private saving available
Ask with a clear boundary
thinkingmodels answers from published entry context only.
Your question is sent to thinkingmodels. The answer uses public entry context only.
RELATED MODELS