# Law of Demeter

A method should talk to its direct collaborators, not reach deep into their parts.

## 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();
```

Level: Freelancer · [More OOP terms at this level](https://www.ask-codey.com/glossary/subjects/oop/freelancer)

Updated: September 27, 2026

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