# Pure cores reduce timeline coupling

Principle `pure-cores-reduce-timelines`. Move deterministic rules out of time-dependent actions and shared mutable state.

Also searched as: functional core, actions and calculations, timeline.

A functional core keeps domain rules independent of external interfaces and process machinery. Fewer shared timelines remove ordering problems before coordination is added.

> Our core doesn’t access external interfaces or use any process machinery your component might use.

Source: [Q14](/bibliography#q14); [B3](/bibliography#b3-designing-elixir-systems-with-otp), [B13](/bibliography#b13-grokking-simplicity).

## Failure it prevents

Rules change with hidden time or shared state and can only be tested through live integrations.

## Our Effect 4.0.5 reading

Keep pure rules as ordinary functions. Context.Service and Layer place effectful dependencies behind seams. Wrapping a callback in Effect does not make it pure.

Source: `packages/effect/src/Context.ts`, `packages/effect/src/Layer.ts`, `packages/effect/src/Effect.ts`.

## How to check

Run the same decision with the same explicit data. Check that it needs neither network nor process state. This is our proposed verification, not a quoted procedure.

Continue with [Replay needs stable inputs](/principles/replay-needs-stable-inputs), [Recovery needs model tests](/principles/recovery-needs-model-tests).

Connect this to [the existing rat-stack guidance](https://ratstack.sh/lore/layers-make-dependencies-explicit).

Use [the durability skill](/skills/durability) for the full review. Return to [the durability index](/principles/durability).

## Skills
- [Durability starts with a recovery record](/principles/durability)

## Sources
- Gray II, James Edward; Tate, Bruce A. *Designing Elixir Systems with OTP*. Pragmatic Bookshelf, 2019. [Link](https://pragprog.com/titles/jgotp/designing-elixir-systems-with-otp/). ([b3-designing-elixir-systems-with-otp](/bibliography#b3-designing-elixir-systems-with-otp))
- Normand, Eric. *Grokking Simplicity: Taming Complex Software with Functional Thinking*. Manning, 2021. [Link](https://www.manning.com/books/grokking-simplicity). ([b13-grokking-simplicity](/bibliography#b13-grokking-simplicity))

## References
- [Effect contributors. Effect 4.0.5. Context.ts](https://github.com/Effect-TS/effect/blob/7f524e25cfb49a71ac39b0f44278d08d40dda5de/packages/effect/src/Context.ts). Pinned source for our Effect mapping, not a claim from the book.
- [Effect contributors. Effect 4.0.5. Layer.ts](https://github.com/Effect-TS/effect/blob/7f524e25cfb49a71ac39b0f44278d08d40dda5de/packages/effect/src/Layer.ts). Pinned source for our Effect mapping, not a claim from the book.
- [Effect contributors. Effect 4.0.5. Effect.ts](https://github.com/Effect-TS/effect/blob/7f524e25cfb49a71ac39b0f44278d08d40dda5de/packages/effect/src/Effect.ts). Pinned source for our Effect mapping, not a claim from the book.
