DEV Community

Said Olano
Said Olano

Posted on

Law of Demeter Principle

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.

Top comments (0)