Law of Demeter Principle

Said Olano - Nov 4 '23 - - Dev Community

Don't talk to strangers.

  • It usually tightens coupling
  • It might reveal too much implementation details

A method of an object may only call methods of:

  • The object itself.
  • An argument of the method.
  • Any object created within the method.
  • Any direct properties/fields of the object.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .