A pure layer contains deterministic code that declares behavior without evaluating it in an impure environment. Its services use functional interfaces and declarative data-storage descriptions; real storage and other effects belong elsewhere. section 2.2.1
Use the boundary to keep architectural responsibilities visible:
- Keep domain models, data types, DSLs, and domain logic pure; impure cases are treated as harmful. section 2.2.1
- Let business-logic scenarios describe application behavior and translate them into impure code only when they must operate through the interoperability layer. section 2.2.1
- Place evaluation, outer-world access, and impure actions in the impure layer, which interprets logic declared by the pure layer. section 2.2.1
- Treat pure state as allowed in the pure layer, while impure state remains disallowed there and permitted in the impure layer. section 7.1.2
A sandwich recipe with logging
A sandwich recipe can remain a declarative script: start the sandwich, add cheese and salt, finish it, and request an informational log. The pure script describes these operations; an impure interpreter reads and updates ingredient state, emits logs, and handles missing ingredients. section 7.1.2
Figure 2.13 Layers: descriptions and responsibilities
Use the layer diagram to trace how pure descriptions, business logic, interoperability, presentation, and impure evaluation divide responsibilities. section 2.2.1
