# The canon is grouped twice

> This section covers the two groupings of the canon and the different questions they answer.

Page: Architecture · Principles
Canonical: https://banes-lab.com/software-architecture/principles#the-canon-is-grouped-twice

This section is stop 58 of 102 in the learning route. Previous: [02 - Every record has a kind](https://banes-lab.com/software-architecture/principles/every-record-has-a-kind.md). Next: [04 - Computation and resource](https://banes-lab.com/software-architecture/principles/computation-and-resource.md). It builds on [01 - Principles are typed](https://banes-lab.com/software-architecture/principles/principles-are-typed.md), [02 - Every record has a kind](https://banes-lab.com/software-architecture/principles/every-record-has-a-kind.md), [03 - The layer spine](https://banes-lab.com/software-architecture/model/the-layer-spine.md).

This section covers the two groupings of the canon and the different questions they answer. The records are held in topical categories, so a reader looking for [least privilege](https://banes-lab.com/records/arch/least-privilege.md) finds it beside the other security records and [backpressure](https://banes-lab.com/records/arch/backpressure.md) beside the other [resilience](https://banes-lab.com/records/arch/resilience.md) records. Each category is then [a member of one layer](https://banes-lab.com/ontology/schema/the-membership.md), in the topology shown in [C1·a the layers](https://banes-lab.com/software-architecture/principles#the-canon-is-grouped-twice-panel-a), and the layers are where tensions resolve, because a layer is a scope a principle can hold whole in.

### By topic for people, by layer for checks

A canon organised one way answers one question, and the other question is answered from memory. Two principles pull against each other, the reviewer looks for the domain each belongs to, and finds two topical categories that say nothing about scope, so the tension is settled by the reviewer who argues longer. One grouping cannot serve both a reader and a check, because a reader looks by topic and a check decides by scope, and a canon that picks one leaves the other question answered by guesswork.

For this reason a canon is grouped by topic for people and by layer for checks, and the layer is derived from the topic rather than stated beside it. Both groupings are kept rather than one being picked, at the cost of one derivation between them. In practice, records are grouped by topic for the reader looking for one, and every topical group maps to exactly one layer for the check that has to decide a scope. The two groupings are held as data with one derivation between them, so a record's layer is read from its category and never stated twice. Which layer observes, feeds or cuts across which is recorded too, because that topology is what a scope-separation between two principles is decided against.

To check this, take any principle and name its layer without opening the record, from its category alone. If the category does not decide it, the grouping is a reading order and not a scope, and no tension that names this principle can be resolved by data. A grouping is a lookup structure and never a claim about a record. A principle in the security category is not more important than one in the structural category, and a layer is not a rank. The layer says only which scope a principle holds whole in.

### The layers

Four layers form the core. [Computation](https://banes-lab.com/records/layer/computation-core.md) is stateless and its outputs are frozen. [Resource](https://banes-lab.com/records/layer/resource-core.md) is stateful, and every handle has one owner and a bounded lifetime. [Execution](https://banes-lab.com/records/layer/execution-core.md) is control flow and events. [Structural](https://banes-lab.com/records/layer/structural-core.md) applies to everything and observes itself.

Beneath the core sit [human factors](https://banes-lab.com/records/layer/human-factors.md), which bound the whole by what a developer can hold, and [evolution](https://banes-lab.com/records/layer/evolution-principles.md), which says how the whole changes over time. Around the core sit the twelve layers that cut across it, which are [correctness](https://banes-lab.com/records/layer/correctness-core.md), [security](https://banes-lab.com/records/layer/security-core.md), [performance](https://banes-lab.com/records/layer/performance-core.md), [contracts](https://banes-lab.com/records/layer/contracts-core.md), [causality](https://banes-lab.com/records/layer/causality-core.md), [declarative design](https://banes-lab.com/records/layer/declarative-core.md), [extensibility](https://banes-lab.com/records/layer/extensibility-core.md), [observability](https://banes-lab.com/records/layer/observability.md), [enforcement](https://banes-lab.com/records/layer/enforcement-core.md), the [atomic boundary](https://banes-lab.com/records/layer/atomic-boundary.md), [domain modeling](https://banes-lab.com/records/layer/domain-modeling.md) and [design patterns](https://banes-lab.com/records/layer/design-patterns-core.md).

The [topology](https://banes-lab.com/ontology/schema/the-layer-topology.md) records which layer observes, feeds or cuts across which. A principle stated in one layer reaches the others by relation, never by being restated there.

### One derivation, never two facts

The derivation is [single source of truth](https://banes-lab.com/records/arch/single-source-of-truth.md) applied to the grouping, and the same reasoning shapes how a record names its relations. Identity is the one thing written literally, and everything that points at a record does so by a name that resolves to that identity, so a leaf record depends on nothing beside it and a display name can be corrected without breaking an edge. Held that way the canon is a graph rather than a list, the [whole of it is traversable](https://banes-lab.com/records/algo/architecture-knowledge-graph.md), and each [principle record](https://banes-lab.com/records/algo/architectural-relationship-record.md) reconciles to one vocabulary rather than the vocabulary bending to the records.

C1·a the layers

```mermaid
flowchart TB
subgraph core["The four core layers"]
computation["computation · stateless"]
resource["resource · stateful"]
execution["execution · control flow and events"]
structural["structural · applies to all, observes itself"]
end
human["human factors · what a developer can hold"]
evolution["evolution · how the whole changes"]
subgraph crosscut["Cross-cutting layers · each cuts across the structural core"]
correctness["correctness"]
security["security"]
performance["performance"]
contracts["contracts"]
causality["causality"]
declarative["declarative"]
extensibility["extensibility"]
observability["observability"]
enforcement["enforcement"]
atomic["atomic boundary"]
domain["domain modeling"]
patterns["design patterns"]
end
resource -- observe --> computation
computation --> execution
resource --> execution
execution --> structural
structural -- feedback --> execution
structural --> human
structural --> evolution
evolution --> human
crosscut -. cross-cuts .-> structural
```

## Links to

- [Least Privilege](https://banes-lab.com/records/arch/least-privilege.md)
- [Backpressure](https://banes-lab.com/records/arch/backpressure.md)
- [Resilience](https://banes-lab.com/records/arch/resilience.md)
- [The membership](https://banes-lab.com/ontology/schema/the-membership.md)
- [Computation Core](https://banes-lab.com/records/layer/computation-core.md)
- [Resource Core](https://banes-lab.com/records/layer/resource-core.md)
- [Execution Core](https://banes-lab.com/records/layer/execution-core.md)
- [Structural Core](https://banes-lab.com/records/layer/structural-core.md)
- [Human Factors](https://banes-lab.com/records/layer/human-factors.md)
- [Evolution Principles](https://banes-lab.com/records/layer/evolution-principles.md)
- [Correctness Core](https://banes-lab.com/records/layer/correctness-core.md)
- [Security Core](https://banes-lab.com/records/layer/security-core.md)
- [Performance Core](https://banes-lab.com/records/layer/performance-core.md)
- [Contracts Core](https://banes-lab.com/records/layer/contracts-core.md)
- [Causality Core](https://banes-lab.com/records/layer/causality-core.md)
- [Declarative Core](https://banes-lab.com/records/layer/declarative-core.md)
- [Extensibility Core](https://banes-lab.com/records/layer/extensibility-core.md)
- [Observability](https://banes-lab.com/records/layer/observability.md)
- [Enforcement Core](https://banes-lab.com/records/layer/enforcement-core.md)
- [Atomic Boundary](https://banes-lab.com/records/layer/atomic-boundary.md)
- [Domain Modeling](https://banes-lab.com/records/layer/domain-modeling.md)
- [Design Patterns Core](https://banes-lab.com/records/layer/design-patterns-core.md)
- [The layer topology](https://banes-lab.com/ontology/schema/the-layer-topology.md)
- [Single Source of Truth](https://banes-lab.com/records/arch/single-source-of-truth.md)
- [Architecture Knowledge Graph](https://banes-lab.com/records/algo/architecture-knowledge-graph.md)
- [Architectural Relationship Record](https://banes-lab.com/records/algo/architectural-relationship-record.md)

## Linked from

- [The layer topology](https://banes-lab.com/ontology/schema/the-layer-topology.md)
