Review a Service for Shared State
Added 2026-11-04
A shared database, cache or file is coupling by another name.
Here is how our two services interact (below). Review the shared state: 1) list shared storage, cache, queues or files; 2) separate read-only sharing from concurrent writes; 3) name the problems concurrent writes cause — race, overwrite, ordering; 4) suggest how to reduce coupling — split, assign ownership, use events; 5) say which sharing is actually reasonable. Do not suggest splitting everything into microservices.
Site original
Chinese original
How to use
服务拆分的最大阻力,往往是一张共享的表。
Try tweaking it
- Have it restate requirements and constraints before writing code.
- Ask for the smallest change plus a rollback path, not a full-file rewrite.
What you should get
- A minimal, runnable change with copy-ready code
- Impact list: which files and call sites must follow
Common mistakes
- Asking it to touch ten files at once, then losing track of what broke what.
- Pasting only the error, with no code or version, and getting an unfixable answer.
How to check the output
- The change runs, can be rolled back, and touches nothing unrelated.
- Edge cases (empty, oversized, concurrent) are covered or explained.
Where it works
- Good for: having it restate requirements and constraints, then propose the smallest runnable change.
- Watch out: include versions and a minimal reproduction with the error, or the fix may look plausible but not fit.