Law of Demeter

Definition from Wiktionary, the free dictionary
Jump to navigation Jump to search



Named for its origin in the Demeter Project, an adaptive programming and aspect-oriented programming effort, itself named after the Greek goddess Demeter.

Proper noun[edit]

Law of Demeter

  1. (software, object-oriented programming) A design guideline for developing particularly object-oriented programs that mandates loose coupling between objects.
    Synonyms: LoD, principle of least knowledge
    • 1996, Karl J. Lieberherr, Adaptive Object-oriented Software: The Demeter Method with Propagation Patterns, Pws Publishing Company (→ISBN)
      An adaptive program contains only hooks into the class structure and normally does not fully encode the details of the class structure. This idea of not duplicating the class structure is an application of the key idea behind the Law of Demeter.
    • 1998, Scott W. Ambler, Building Object Applications that Work: Your Step-by-Step Handbook for Developing Robust Systems with Object Technology, Cambridge University Press (→ISBN), page 249:
      According to the Law of Demeter, the second approach is better because the summary screen sends a message only to an object that is returned by one of its methods []


Further reading[edit]