Law of Demeter

ignorance is bliss


Do not refer to a class C in a method m unless C is (the type of)


   1. an instance variable
   2. an argument of m
   3. an object created in m
   4. a global variable
  

  • Minimize the number of acquaintances!

Class transformations

  • lifting -- make structure of the class invisible
  • pushing -- push down responsibility

slide: The Law of Demeter