layered architecture
Organising a system into ranked layers where each layer may only use layers below it.
In more detail
In an application the layers might be request handling, business logic and data access; in a design system they might be tokens, primitives, components and page templates. Dependencies flow in one direction only, from higher layers down to lower ones. That rule prevents circular dependencies and lets you change a lower layer knowing exactly what sits on top of it.
Example
The lesson registry gives token.color layer 0 and button.atom layer 1, and rejects any node whose dependency sits on the same or a higher layer.Related terms
- layer inversion — A mistake where a lower layer depends on a higher one, such as a colour token that refers to a button component.
- circular dependency — Two or more pieces of code or data that depend on each other in a loop, so none can be built or resolved first.
- design foundations — The lowest layer of a design system: the basic colour, typography and spacing decisions every component is built from.
- primitive — A small, general-purpose building block, such as a button, input or dialog, that product components are assembled from.
- application service — A class that carries out one use case by applying business rules and coordinating repositories and other services.
- repository pattern — Putting all the code that reads and writes one kind of data behind a single object, so the rest of the app never talks to the database directly.
- DTO — A plain object whose only job is to carry data across a boundary, such as the body of an API request or response.
- controller (Spring) — A Spring class, usually marked @RestController, whose methods handle HTTP requests for particular paths and return response bodies.
- service layer — The layer of an application that holds use cases and business rules, sitting between controllers and repositories.
- exception translation — Catching a low-level exception at a boundary and throwing a higher-level one that fits the caller's vocabulary, keeping the original as the cause.
Taught in
- Design Systems Architecture: Foundations, Layers & Taxonomy — Design Systems & Component Engineering
- The Repository Pattern — Modern .NET Core, C# & Enterprise Microservices
- Manual Object Mapping — Modern .NET Core, C# & Enterprise Microservices
- Checked Versus Unchecked Exceptions — Modern Java: Virtual Threads & High-Throughput Services
- The Cost Of Checked Exceptions — Modern Java: Virtual Threads & High-Throughput Services
- Designing Testable Code — Modern Java: Virtual Threads & High-Throughput Services
- Tying It All Together — Modern Java: Virtual Threads & High-Throughput Services