Message Chains

Referenced by patterns
Symptom

Long dotted access paths the agent must trace through several object hops to understand any single read; renaming any intermediate field breaks every caller silently.

Goal

Callers ask the closest object for what they want; the agent reads one method signature instead of walking N link types to predict what the chain produces.

Smellier version

const street = order.customer.address.street;

Fresher version

const street = order.customerStreet();
Example source: Illustrative example written for this site, not a quotation from any source.
Pressure

Every link in the chain is a coupling point the agent must hold in working memory; refactoring any intermediate shape requires the agent to find and update every chained access.

Tradeoff

Adding passthrough methods on the host class grows its surface; for chains used in one place the passthrough is overhead the agent now maintains in two places.

Relief

Encapsulation tightens; intermediate objects can change shape without breaking callers; the agent reasoning about a caller doesn't load every link in the chain.

Trap

Wrapping every dotted chain in passthroughs migrates the smell from call sites into the host class's surface — the agent now reads a wall of delegation methods to find any real behavior.