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 revision Previous revision
principles:invariant_avoidance_principle [2013-06-22 20:42]
christian
principles:invariant_avoidance_principle [2018-12-17 16:44]
2.247.246.40 Fixed little typo.
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.
principles/invariant_avoidance_principle.txt · Last modified: 2018-12-17 16:44 by 2.247.246.40