Separate Pure Core From Effects
BOUNDARY-SEPARATE-PURE-CORE-FROM-EFFECTS
Summary
Move domain computation away from rendering, I/O, mutation, and global state when effects obscure the decision being tested. The split gives tests a stable surface, but should be skipped when it adds indirection without a useful boundary.
Rule
Separate pure computation from rendering, I/O, or mutation when that gives tests a stable surface.
Why
Rendering, filesystem access, network calls, terminal mutation, and global state make behavior harder to test. Separating a pure core from effects gives tests a stable surface and lets adapters handle side effects explicitly.
Helps
- Improves testability and keeps domain decisions visible without running the environment.
Limits
Do not split code when the separation adds indirection without a useful test or ownership boundary. Use it when effects obscure the core decision.
Agent Instruction
Separate pure computation from I/O, rendering, mutation, and global state because that gives tests a
stable behavior surface.Mechanisms
Supported by pure functions, command objects, adapter layers, fixtures, snapshot tests, and integration tests for the effect boundary.