User Tools

Site Tools


principles:invariant_avoidance_principle

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
principles:invariant_avoidance_principle [2013-03-11 16:30] christianprinciples:invariant_avoidance_principle [2021-09-02 12:37] – old revision restored (2021-03-27 09:52) 65.21.179.175
Line 1: Line 1:
-====== Invariant Avoidance Principle ======+====== Invariant Avoidance Principle (IAP) ======
  
 ===== Variants and Alternative Names ===== ===== Variants and Alternative Names =====
Line 6: Line 6:
 ===== Context ===== ===== Context =====
 /* fill in contexts here: */ /* fill in contexts here: */
-  * [[contexts:Object-Oriented Design]]  +  * [[contexts:Object-Oriented Design]]
  
 ===== Principle Statement ===== ===== Principle Statement =====
Line 48: Line 47:
 ===== Origin ===== ===== Origin =====
  
-This principle is newly introduced here.+{{page>resources:A Principle Language for Object-Oriented Design#reference}}
  
  
Line 80: Line 79:
   * [[Fail Fast]] (FF): Breaking an invariant is a defect. And in such a case the software should fail fast.   * [[Fail Fast]] (FF): Breaking an invariant is a defect. And in such a case the software should fail fast.
   * [[Don't Repeat Yourself]] (DRY): Duplication of information, like having the same data in different representations or like caching values, creates invariants. So an invariant sometimes is a hidden DRY violation.   * [[Don't Repeat Yourself]] (DRY): Duplication of information, like having the same data in different representations or like caching values, creates invariants. So an invariant sometimes is a hidden DRY violation.
 +  * [[Low Coupling]] (LC): One type of precondition is that a specific method has to be called prior to another one. This also results in a temporal coupling.
  
 ==== Principle Collections ==== ==== Principle Collections ====
Line 140: Line 140:
 ==== Example 3: C++ References ==== ==== Example 3: C++ References ====
  
-Sompare the following two methods:+Compare the following two methods:
  
 <code c++> <code c++>
Line 174: Line 174:
 /* Choose one of the following and comment out the rest: */ /* Choose one of the following and comment out the rest: */
 /*[[wiki:Stub]]*/ /*[[wiki:Stub]]*/
-[[wiki:Incomplete]] +/*[[wiki:Incomplete]]*
-/*[[wiki:Complete]]*/+[[wiki:Complete]]
  
 ===== Further Reading ===== ===== Further Reading =====
  
 +  * {{page>resources:A Principle Language for Object-Oriented Design#reference}}
 +
 +===== Discussion =====
  
 +Discuss this wiki article and the principle on the corresponding [[talk:principles:Invariant Avoidance Principle|talk page]].
principles/invariant_avoidance_principle.txt · Last modified: 2021-10-18 21:53 by christian