デザイン・バイ・コントラクト(DbC)は、メソッドと呼び出し元の関係を形式的な契約として扱い、3つの要素で定義されます: 前提条件(呼び出し元が保証すべきこと)、事後条件(メソッドが返す保証)、および不変式(オブジェクトが常に真であるべきこと)。
3つの義務
text
PRECONDITION → caller's duty: inputs/state the method requires to run correctly
POSTCONDITION → method's duty: what it promises on return (if precondition held)
INVARIANT → always-true property of the object, before and after every method
