Coupling Required
Make the order of calls impossible to get wrong
If methods must run in a set order, the code must enforce it. Never rely on callers remembering to call init() first.
How to do it
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.
Example
# 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)
// Good: each step returns the only thing you can do next
const receipt = await cart.checkout(address).pay(card);
How to 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.
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.