jargon

Architecture & practice·Design, structure and tradeoffs

you wrote order.getCustomer().getAddress().getPostcode() and a change three objects away broke your line.

Law of Demeter

Also calledprinciple of least knowledge, don't talk to strangers

Talk only to your immediate collaborators, not to their collaborators' collaborators. Each dot in a chain like that is a structural assumption about somebody else's internals, so a chain of four is four ways for a change elsewhere to break you. The point is not the dot count — it is that you have coupled to a shape rather than to a service, and the fix is usually to ask the first object for the answer rather than for its parts.

Commonly confused with