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
principles:invariant_avoidance_principle [2021-09-02 12:37] – old revision restored (2021-05-11 21:58) 65.21.179.175principles:invariant_avoidance_principle [2021-10-18 21:53] (current) – +++ restored +++ christian
Line 17: Line 17:
 Methods typically have preconditions. Something that has to be true prior to invoking the method so it can work properly. Typical cases are parameters that may not be ''null'' or have to be in a certain range. A solution is better the fewer preconditions there are. Methods typically have preconditions. Something that has to be true prior to invoking the method so it can work properly. Typical cases are parameters that may not be ''null'' or have to be in a certain range. A solution is better the fewer preconditions there are.
  
-Furthermore there are (class) invariants, i.e. conditions that have to be true in all observable states during the whole lifetime of an object. Typical invariants are attributes that may not be ''null'' or have to be in a certain range, lists that have to contain certain objects with certain properties, etc. A solution better the fewer invariants there are.+Furthermore there are (class) invariants, i.e. conditions that have to be true in all observable states during the whole lifetime of an object. Typical invariants are attributes that may not be ''null'' or have to be in a certain range, lists that have to contain certain objects with certain properties, etc. A solution is better the fewer invariants there are.
  
 While preconditions and invariants are absolutely necessary, introducing further ones comes at a certain cost. While preconditions and invariants are absolutely necessary, introducing further ones comes at a certain cost.
Line 47: Line 47:
 ===== Origin ===== ===== Origin =====
  
-This principle is newly introduced here.+{{page>resources:A Principle Language for Object-Oriented Design#reference}}
  
  
Line 179: Line 179:
 ===== 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.1630579072.txt.gz · Last modified: 2021-09-02 12:37 by 65.21.179.175