# Law of Demeter

*noun*

say it: **“LAW uv dih-MEE-ter”** **/lɔ əv dɪˈmitər/**

The advice that an object should talk only to its close neighbors, not reach through them to their neighbors.

## What is **Law of Demeter**?

The **Law of Demeter** ("talk only to your friends") says a method should use its own objects, not reach through them into their parts. Avoid chains like `order.Customer.Address.City`.

```csharp
// Reaching through objects
var city = order.Customer.Address.City;

// Asking directly
var city = order.ShippingCity();
```

## In a sentence

- “Following the **Law of Demeter**, the screen asked the booking for the price instead of walking to the plan.”

Level: Freelancer · [More OOP terms at this level](https://www.ask-codey.com/glossary?category=oop&level=4)

Updated: November 9, 2026

Source: https://www.ask-codey.com/glossary/law-of-demeter
