# Layers and Components Decomposition

**In short:** Layers and components split a system two ways. Layers stack by kind of work, and upper layers use lower ones. Components are vertical slices that each cover one function. Together they form a grid.

## Explanation

A system can be split in two directions. Each direction answers a different question.

**Horizontal split: layers.** A layer groups code by kind of work. One common split has three broad layers: presentation (the user interface), domain logic (the business rules), and data access. Dependencies generally run from top to bottom. Upper layers use lower ones, not the other way around.

Layers are logical. They organize the code. They do not describe physical deployment tiers.

**Vertical split: components.** A component is a slice that runs through the layers. For large systems, one suggestion is to split the top level into domain-oriented modules and then layer each module internally. Domain-oriented means the slices follow the business, not the technology. Domain-Driven Design takes a similar view. It divides a large system into Bounded Contexts, each with a unified model. See the articles Domain-Driven Design and Bounded Context.

**Combining both.** Put layers on one axis and components on the other. Each cell of the grid holds the part of one component that lives in one layer.

**Documenting it.** The arc42 building block view shows the static decomposition of the system into building blocks. It is hierarchical. Level 1 is a white box of the whole system. Deeper levels zoom into chosen blocks. For blocks you do not open up, arc42 advises hiding their inner workings.

## Example

An online shop uses three layers: presentation, domain logic, and data access. Its components are Catalog, Orders, and Payment. The Orders component has its own screens, its own order rules, and its own data access. The Orders screens call the Orders rules. The Orders rules call the Orders data access. The building block view lists Catalog, Orders, and Payment at level 1. A deeper level can zoom into Orders.

## Trade-offs

The facts here do not compare costs and benefits in detail. One point is clear: layers are a logical structure only. Do not read them as a deployment plan. Choosing component boundaries that follow the business is a design choice. The domain-oriented approach ties the slices to the business rather than to technology.

Layers (rows) and components (columns) form a grid. Each component has a slice in every layer.

```mermaid
flowchart TB
  subgraph Catalog
    C1[Presentation] --> C2[Domain logic] --> C3[Data access]
  end
  subgraph Orders
    O1[Presentation] --> O2[Domain logic] --> O3[Data access]
  end
  subgraph Payment
    P1[Presentation] --> P2[Domain logic] --> P3[Data access]
  end
```

## Checks

- The building block view shows the static decomposition of the system, with level 1 as a white box of the whole system.
- Layer dependencies run top to bottom, and the document says layers are logical, not physical tiers.
- Blocks that are not detailed are shown as black boxes with their inner workings hidden.

## Related

- [Layered Architecture](https://arc.fuet.ch/concepts/styles-patterns/layered-architecture.md)
- [Layers Pattern](https://arc.fuet.ch/concepts/styles-patterns/layers-pattern.md)
- [Modularity](https://arc.fuet.ch/concepts/principles/modularity.md)
- [Coupling and Cohesion](https://arc.fuet.ch/concepts/principles/coupling-and-cohesion.md)
- [Separation of Concerns](https://arc.fuet.ch/concepts/principles/separation-of-concerns.md)
- [Bounded Context](https://arc.fuet.ch/concepts/domain-driven-design/bounded-context.md)
- [Domain-Driven Design](https://arc.fuet.ch/concepts/domain-driven-design/domain-driven-design.md)
- [Deriving System Components from the Domain Model](https://arc.fuet.ch/concepts/domain-driven-design/deriving-system-components-from-the-domain-model.md)

## Sources

- [Presentation Domain Data Layering](https://martinfowler.com/bliki/PresentationDomainDataLayering.html) — martinfowler.com, accessed 2026-11-09
- [5 - Building block view | arc42 Documentation](https://docs.arc42.org/section-5/) — docs.arc42.org, accessed 2026-11-09
- [Bounded Context](https://martinfowler.com/bliki/BoundedContext.html) — martinfowler.com, accessed 2026-11-09
