Java Tell Dont Ask

Decision ownership: the type that owns an invariant or policy makes the decision. Use when a service reads state with getters, decides, and writes state back (if (acct.getBalance() > x) acct.setBalance(...)), when the same rule is re-derived from the same getters in several places, when an invariant exists but no type enforces it, when a domain model is all getters and setters with the logic in services, or when a getter has side effects. Covers command–query separation and when asking is correct: boundaries, reporting, cross-aggregate orchestration. Does not cover the navigation chains that often carry the asking — that is java-law-of-demeter.

robsonkades 071dfe0 4 files · 21.0 KB Updated

File contents

robsonkades/agent-skills/tree/main/skills/java-tell-dont-ask commit 071dfe0b4d

Frequently asked questions

npx skillmds@latest add robsonkades/java-tell-dont-ask