Views on Design By Contract or code contract -
i reading understand more design contract / code contract.
as know, write contracts (invariants, pre , post conditions) ensure codes can maintain orderly. guarantees bugs prevented defined mechanism based on checks , balances
but wouldnt implicated software performance? there additional checks between each method calls.
i appreciate people share views , experience design contract me. disadvantages or advantages welcome.
typically such frameworks support runtime checks , static ananlysis. latter performed @ compile time (or before); not slow down code @ all. former potentially affect performance.
the microsoft research code contracts project nice example of this. can configure system such that:
static analysis applies subset of possible contract enforcement @ compile time, or within deigner environment;
runtime checks enabled code compiled in debug mode; and
a subset of runtime checks enabled public api of code compiled in release mode (non-public code has no runtime checks).
this compromise between performance , robustness.
Comments
Post a Comment