liveBook · Manning

Layered architecture

As explained in Microservices Patterns, Second Edition

An architectural style that organizes software elements into layers with defined responsibilities and constrained dependencies.

Layered architecture organizes software into layers with defined responsibilities and constrained dependencies. Strict layering allows each layer to depend only on the one immediately below; relaxed layering permits dependencies on any lower layer. section 3.3.1

A common three-tier structure assigns responsibilities as follows:

This structure has trade-offs. A single presentation or persistence layer may not reflect applications with multiple callers or databases. Depicting business logic as dependent on persistence can also make database-free testing difficult. In a well-designed dependency arrangement, business logic defines data-access interfaces and persistence implements them, reversing the dependency shown by the layers. In a monolith, technical layers can also scatter each subdomain’s code across the application. section 3.3.1 section 6.2.1

FTGO monolith

The consumers, orders, and notifications subdomains are each spread across web, domain, and persistence layers. Consumer and order controllers sit in web; their business classes sit in domain; and repositories sit in persistence. section 6.2.1

Figure 6.7 In a technology-oriented layered architecture, the code for each subdomain is scattered across the technical layers. As a result, there’s a mismatch between the application architecture and the subdomains and the teams that develop them.
layered monolithic architecture

Shows how technical layers scatter subdomain code, creating a mismatch between architecture and the subdomains and teams that develop it. section 6.2.1

How Microservices Patterns, Second Edition covers it

How deep it goes
Defines strict and relaxed dependency rules, maps three tiers, and identifies dependency and representation drawbacks.
Examples
Uses an FTGO monolith to show consumer, order, and notification code spread across web, domain, and persistence layers.
What you can do after
Evaluate whether technical layers fit an application by weighing dependency constraints against multiple interfaces, databases, and subdomain organization.
How it connects
Connects architectural styles to domain views and contrasts layered architecture with hexagonal architecture in monoliths.

Also explained in

Compare how 3 books explain layered architecture →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Microservices Patterns, Second Edition. The section links point to the parts of the book it draws on.