Cognitive Scaffold

Preparing your thinking workspace

arrow_back_ios_new
MENTAL MODEL · M2225

Law of Demeter

Law of Demeter
SystemsHigh supportSystems Theory
Included
account_tree

Updated 2026-07-30

Loading revision record…

Summary

The Law of Demeter (LoD) or principle of least knowledge is a design guideline for developing software, particularly object-oriented programs. In its general form, the LoD is a specific case of loose coupling. The guideline was proposed by Ian Holland at Northeastern University towards the end of 19…

Definition

Also known as the 'principle of least knowledge'. An object should have as little knowledge as possible about other objects. Only talk to your immediate friends, do not talk to 'friends of friends'. Scaffold use: - Decoupling thinking: In a company, do not command over the head of subordinates, do not interfere in details across departments. Reducing the coupling between modules (departments) allows the system to avoid total collapse during local chaos.

How to use

- Decoupling thinking: In a company, do not command over the head of subordinates, do not interfere in details across departments. Reducing the coupling between modules (departments) allows the system to avoid total collapse during local chaos.

Mechanism

Objects should only communicate with immediate friends, not 'friends of friends', to reduce coupling.

Practice

In progress 0/1

Practice this model in one real situation:

Check to track your progress (stored locally)
Learning progress0%

Cases

  • Refactor to a.doViaB() to hide internal structure.

Common pitfalls

  • Over-encapsulation leads to a large number of meaningless wrapper methods.
Sources

Source support: Explicit

References currently contain only Wikipedia links; primary sources still need review.

  • link
    en.wikipedia.orghttps://en.wikipedia.org/wiki/Law_of_DemeterZH · Explicit
    verified
account_treeGenealogyexpand_more

RELATED MODELS