Friday, November 10, 2017

Contract-First Design OR Design by Contract (DbC)


  • "DbC Is an approach for designing software. 
  • It 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, post conditions and invariants. These specs are referred to as Contracts…
  • The Design by Contract (DBC) software development technique ensures high-quality software by guaranteeing that every component of a system lives up to its expectations. 
  • Bertrand Meyer developed DBC as part of his Eiffel programming language."

Note: Double quoted text indicates the content is sourced from another site. Three essentials of DbC are:

1. Preconditions
2. Postconditions
3. Class invariants


  • Central to DBC is the notion of an assertion -- a Boolean expression about the state of a software system.
  • At runtime we evaluate the assertions at specific checkpoints during the system's execution. 
  • n a valid software system, all assertions evaluate to true. In other words, if any assertion evaluates to false, we consider the software system invalid or broken.
  • DBC's central notion somewhat relates to the #assert macro in C and C++ 

No comments:

Post a Comment

Full capabilities of ChatGPT 4 O (O for Omni) - From Openai.com

Omni, O, has multimodal capabitlies, which means it can take text, voice or video as an input and serve audio/text/image output (there's...