Tell-don’t-ask
Also known as Tell-don’t-ask, Tell-don’t-ask in software engineering
Definition
A design guideline that favors asking an object to perform behavior instead of extracting its state to decide elsewhere.
What it means
Tell-don’t-ask encourages behavior to live with the data and invariants it governs. Rather than reading an object’s fields, branching in another class, and writing the result back, a caller can send a meaningful command. This can reduce duplicated rules and keep ownership clear.
Example
A checkout flow asks an account for balance, checks a limit, and mutates status externally. Moving the decision into an account operation lets the account enforce the invariant consistently.
Limitations
The guideline can create overly large objects if every decision is pushed into one model. Query operations are appropriate when a caller truly owns the policy or needs a projection. Use responsibility and change ownership to choose.
How to use the signal
Preserve query behavior when the caller genuinely owns the policy, because not every read is misplaced responsibility.
Weave can connect behavior-moving refactors with review and rework patterns. It cannot decide domain ownership, so treat the signal as a prompt for design review.
How this relates to Weave
Weave can connect behavior-moving refactors with review and rework patterns. It cannot decide domain ownership, so treat the signal as a prompt for design review.
Explore Engineering intelligence