Classify responsibilities as pure core or effectful shell in a functional design.
Place each responsibility where it belongs in a functional boundary. Pure core Effectful shell Calculate invoice totals from line items and tax rules All required inputs are values, and the result can be replayed without touching outside systems. Read the current exchange rate from an external API The function observes the outside world, so the boundary should isolate timing, failure, and retries. Validate whether an order state transition is allowed A transition rule can be computed from current state and requested event without performing IO. Persist the accepted order transition to the database Database writes change shared state, so the…
Sign up free — one personalized lesson every day, matched to your role and goals.
Already have an account? Sign in