User Tools

Site Tools


principles:law_of_demeter

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:law_of_demeter [2020-10-12 16:20] – old revision restored (2013-02-25 16:20) 159.69.186.191principles:law_of_demeter [2021-09-02 19:56] – old revision restored (2021-05-11 22:01) 65.21.179.175
Line 27: Line 27:
  
 ===== Strategies ===== ===== Strategies =====
- 
- 
-===== Caveats ===== 
- 
-See section [[#contrary principles]]. 
  
  
Line 39: Line 34:
 ===== Evidence ===== ===== Evidence =====
 /* Comment out what is not applicable and explain the rest: */ /* Comment out what is not applicable and explain the rest: */
-/+/*[[wiki:Proposed]] 
-  * [[wiki:Proposed]] +[[wiki:Examined]] 
-  [[wiki:Examined]] +[[wiki:Accepted]] 
-  [[wiki:Accepted]] +[[wiki:Questioned]]*/
-  [[wiki:Questioned]] +
-*/+
  
  
Line 51: Line 44:
 ==== Generalizations ==== ==== Generalizations ====
  
-  * [[Low Coupling]] (LC): The goal of LoD is to reduce coupling by reducing the knowledge of a class about other classes. +  * [[principles:Low Coupling]]: The goal of LoD is to reduce coupling by reducing the knowledge of a class about other classes. 
-  * [[Tell, Don't Ask/Information Expert]] (TdA/IE)+  * [[principles:Tell, Don't Ask]]
  
 ==== Specializations ==== ==== Specializations ====
Line 58: Line 51:
 ==== Contrary Principles ==== ==== Contrary Principles ====
  
-  * [[More Is More Complex]] (MIMC): Adhering to the Law of Demeter often results in additional methods. +  * [[principles:More Is More Complex]]: Adhering to the Law of Demeter often results in additional methods. 
-  * [[Low Coupling]] (LC): Adhering to the Law of Demeter may create tramp couplings which are bad. +  * [[principles:Low Coupling]]: Adhering to the Law of Demeter may create tramp couplings which are bad. 
-  * [[High Cohesion]] (HC): Adhering to the Law of Demeter often results in additional methods that mirror methods of aggregated objects. As these objects have other responsibilities, the additional methods have fewer commonalities with the "real" methods of the class, which results in a lower cohesion.+  * [[principles:High Cohesion]]: Adhering to the Law of Demeter often results in additional methods that mirror methods of aggregated objects. As these objects have other responsibilities, the additional methods have fewer commonalities with the "real" methods of the class, which results in a lower cohesion.
  
 ==== Complementary Principles ==== ==== Complementary Principles ====
Line 87: Line 80:
   * Phil Haack: //[[http://haacked.com/archive/2009/07/14/law-of-demeter-dot-counting.aspx|The Law of Demeter Is Not A Dot Counting Exercise]]//   * Phil Haack: //[[http://haacked.com/archive/2009/07/14/law-of-demeter-dot-counting.aspx|The Law of Demeter Is Not A Dot Counting Exercise]]//
   * [[http://www.ccs.neu.edu/home/lieber/LoD.html|Law of Demeter]]   * [[http://www.ccs.neu.edu/home/lieber/LoD.html|Law of Demeter]]
- 
principles/law_of_demeter.txt · Last modified: 2021-10-18 21:52 by christian