---
title: "Tell objects what to do · Agent Wranglers"
url: https://agentwranglers.se/playbook/architecture/coupling/tell-dont-ask
updated: 2026-10-20
licence: "All rights reserved"
---

# Tell objects what to do

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

- Level: Recommended
- Chapter: [Coupling](https://agentwranglers.se/playbook/architecture/coupling)
- Rule: Give an object a command instead of reading its state and deciding for it. The rule that uses the data lives next to the data.
- How: When you see `if (x.getStatus() === …) x.setStatus(…)`, move that decision into a method on `x`. The object then guards its own rules, and no caller can break them.
- Check: Reviewers fail code that reads an object's fields only to change the same object. Tests call the new method directly and cover every rule.

Example:

```php
// Bad: every caller must repeat the rule
if ($invoice->getStatus() === 'open' && $invoice->getDueDate() < $today) {
    $invoice->setStatus('overdue');
}

// Good: the invoice keeps its own rule
$invoice->markOverdueIfLate($today);
```

```python
# Bad
if invoice.status == "open" and invoice.due_date < today:
    invoice.status = "overdue"

# Good
invoice.mark_overdue_if_late(today)
```

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers architecture playbook: https://agentwranglers.se/playbook/architecture/coupling/tell-dont-ask`.

- Previous: [Talk only to your direct neighbours](https://agentwranglers.se/playbook/architecture/coupling/law-of-demeter)
- Next: [Make the order of calls impossible to get wrong](https://agentwranglers.se/playbook/architecture/coupling/no-hidden-temporal-coupling)
- [Coupling](https://agentwranglers.se/playbook/architecture/coupling)
