Architecturen-tier architecturetiersarchitecture sinkhole

Layered architecture

Definition

A layered architecture groups code by technical concern into stacked layers; in strict layering a layer may call only the one directly below, in relaxed layering any lower layer.

In practice

Layers are easy to understand and give clear places for UI code, workflow, business rules and persistence, which is why most frameworks default to them. Layers are logical and cost nothing at runtime; tiers are physical deployments, and each tier boundary adds a network hop.

Because dependencies point toward the database, a data change ripples up through every layer. Strict layering breeds the architecture sinkhole anti-pattern: layers that only pass calls through. A feature change also touches every layer, which is what vertical slices and clean architecture try to avoid.

Example

Adding a deliveryNote field touches OrderController, OrderService, Order and OrderRepository, one file in each of the four layers.