---
title: "Make the order of calls impossible to get · Agent Wranglers"
url: https://agentwranglers.se/playbook/architecture/coupling/no-hidden-temporal-coupling
updated: 2026-10-20
licence: "All rights reserved"
---

# Make the order of calls impossible to get wrong

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

- Level: Required
- Chapter: [Coupling](https://agentwranglers.se/playbook/architecture/coupling)
- Rule: If methods must run in a set order, the code must enforce it. Never rely on callers remembering to call `init()` first.
- How: Build objects fully in the constructor, so there is no "not ready yet" state. Let each step return the object for the next step, so the next call only exists after the first. Or wrap the sequence in one function that runs every step in order.
- Check: A test creates the object and calls each public method straight away. Each call either works or cannot be written, because the type does not have it.

Example:

```python
# Bad: forget connect() and send() fails at run time
client = MailClient()
client.connect(host)
client.send(message)

# Good: you cannot get a client without a connection
client = MailClient.connect(host)
client.send(message)
```

```ts
// Good: each step returns the only thing you can do next
const receipt = await cart.checkout(address).pay(card);
```

**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/no-hidden-temporal-coupling`.

- Previous: [Tell objects what to do](https://agentwranglers.se/playbook/architecture/coupling/tell-dont-ask)
- Next: [Pass state in instead of sharing globals](https://agentwranglers.se/playbook/architecture/coupling/no-global-state)
- [Coupling](https://agentwranglers.se/playbook/architecture/coupling)
