Nithin Bekal Posts About

Law of Demeter

Any method of an object should only call methods on:

  • itself
  • any params that were passed into the method
  • any objects it created
  • any composite objects

Also known as Principle of Least Knowledge.

Each unit should have only limited knowledge about other units: only units “closely” related to the current unit. Or: Each unit should only talk to its friends; Don’t talk to strangers. >


  • results in loosely coupled code
  • classes are isolated from distant classes
  • makes code more maintainable