Zum Hauptinhalt springen

Sort pure core from effectful shell

Classify responsibilities as pure core or effectful shell in a functional design.

functional-programming4 min read

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…

Read the full lesson

Sign up free: one personalized lesson every day, matched to your role and goals.

← Back to library

Kontakt aufnehmen