liveBook · Manning

Cross-cutting concern

As explained in Grokking Software Architecture

A software responsibility that spans multiple architectural layers rather than belonging to just one.

A cross-cutting concern is a technical responsibility needed by several layers of an application, rather than belonging to one layer. Logging, authentication, caching, and error handling are common examples. Like plumbing serving every room in a house, these services support many parts of the system without becoming part of any one part’s main job. section 4.5

Keep shared technical work separate from business logic by injecting it as a dependency. An OrderService can use a logger abstraction while a separate logger handles logging. This keeps responsibilities focused, lets implementations be swapped centrally, and makes it possible to test with a fake logger instead of writing to a real file. section 4.5.3

This approach supports the Downward Dependency Rule: layers can use shared services without creating tangled dependencies between business logic and technical details. Advanced frameworks may automate the work through Aspect-Oriented Programming, but the goal remains separation of concerns. section 4.5.3

Figure 4.6 Cross-Cutting Concerns serve multiple layers in an application.

Use the diagram to see shared concerns serving multiple horizontal layers. section 4.5

How Grokking Software Architecture covers it

How deep it goes
Defines the concept and explains injected dependencies, implementation swapping, fake-based tests, and AOP as an advanced alternative.
Examples
Uses logging, authentication, caching, error handling, house utilities, and an OrderService with replaceable or fake loggers.
What it assumes
Assumes familiarity with application layers and the Downward Dependency Rule; it checks both alongside the concern’s definition.
What you can do after
Evaluate how injected shared services keep business logic focused, replaceable, and testable.
How it connects
Connects cross-cutting concerns to layered architecture, separation of concerns, dependency inversion, and Aspect-Oriented Programming.

Also explained in

Compare how 6 books explain cross-cutting concern →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Software Architecture. The section links point to the parts of the book it draws on.