Introduction to OOP: Chapter 17 : Visibility and Dependency [next] [previous] [audio] [real] [text]

Limiting Coupling - the Law of Demeter

The law of demeter is an attempt to limit the way in which one component can interact with another component.

Law of Demter. In any Method M attached to a class C, only methods defined by the following classes may be used:
The instance variable classes of C.

The argument classes of method M (including C); note that global objects or objects created inside the method M are considered arguments to M.
Intro OOP, Chapter 17, Slide 8

Named for the Demeter project at Northwestern University.