M365Con 2027 – free online conference · 11–22 Jan 2027 · 120 sessions m365con.net

Cross-cutting concerns

Concept

Aspects of a program, such as logging, authentication, validation and telemetry, that affect many modules and do not belong inside business logic. They are typically centralized with middleware, decorators or filters.

✦ CONCEPTCross-cutting concernsM365.FM
Title graphic: Cross-cutting concerns (Concept)

Description

Cross-cutting concerns are aspects of a program that affect several modules and cannot be contained in any one of them. Typical examples are logging, authentication, validation, monitoring and telemetry. Because these concerns span many parts of a system, they do not belong inside the business logic of any single component. In practice they are usually centralized with mechanisms such as middleware, decorators or filters, so that the core code can stay focused on its primary purpose.

The term comes from aspect-oriented software development. According to the description of the concept in the sources, a cross-cutting concern often cannot be separated cleanly from the rest of the system in design or implementation. This leads to two recurring problems. The first is scattering, where the same code is duplicated in many places. The second is tangling, where components become heavily interdependent. Either problem can appear on its own, or both can occur together. Procedural, functional and object-oriented styles offer no direct way to handle a primary goal together with a cross-cutting concern, which is why modularity tends to suffer when these concerns are handled ad hoc.

A commonly cited illustration is a medical records application. In that example, indexing records is the core function, while logging changes and authentication cut across many parts of the application. The wider list of cross-cutting concerns named in the sources includes logging, monitoring, caching, validation, persistence, transaction processing, synchronization, security and privacy, error handling, internationalization and memory management. The concept is therefore not limited to one technology or layer; it describes a recurring structural problem in software design.

Aspect-oriented programming addresses these concerns by encapsulating each one in an aspect, which keeps the related code isolated, reusable and easier to maintain. The 1997 paper on aspect-oriented programming by Kiczales and AspectJ are cited as foundations of this approach. In everyday engineering, teams often reach the same goal without a dedicated aspect-oriented language, by placing shared behavior in a single layer that wraps or intercepts requests, which is where middleware, decorators and filters come in.

In the Microsoft ecosystem, the idea appears in the discussion of API gateways. The M365.FM episode "Azure API Management - Simply Explained" describes Azure API Management as an API gateway in a microservices architecture. According to the episode, it manages communication between microservices and clients and addresses cross-cutting concerns such as authentication, authorization, throttling, caching, transformation and monitoring. The episode lists several benefits of this approach: APIM decouples clients from microservices, adds a layer of security, simplifies client integration, and routes incoming requests based on path, method, headers or query parameters. Handling these concerns at the gateway means individual microservices do not each need to implement them separately.

When deciding how to deal with cross-cutting concerns, the central question is where the shared behavior should live. Keeping it inside each module risks duplication and tight coupling between components. Moving it into a shared layer, whether a gateway, middleware, a decorator or a filter, keeps business logic focused and makes the shared behavior easier to change in one place. The sources do not prescribe specific implementation mechanisms, so the choice depends on the architecture and tooling in use.

Overview compiled with AI from M365.FM episodes and the facts on this page. You can improve it with the edit button below.

TypeConcept
WikipediaCross-cutting concerns – Wikipedia en.wikipedia.org

Frequently asked questions

Questions marked with AI were written with AI from the facts on this page.

What are cross-cutting concerns in software? (AI)

They are aspects of a program, such as logging, authentication, validation and telemetry, that affect many modules and cannot be contained in any one of them. They are usually handled separately from business logic.

Why can cross-cutting concerns cause problems? (AI)

They often cannot be separated cleanly from the rest of the system, which leads to scattering, where the same code is duplicated in many places, and tangling, where components become heavily interdependent.

How does Azure API Management relate to cross-cutting concerns? (AI)

The episode "Azure API Management - Simply Explained" says that, as an API gateway in a microservices architecture, it addresses cross-cutting concerns such as authentication, authorization, throttling, caching, transformation and monitoring.

Glossary

Community wiki

Short info above, community knowledge below: add practical tips, examples or corrections. New contributions are reviewed first; trusted members publish directly.

Experts and companies for this topic

Nobody has listed this topic yet. Add it to your profile.

Sources

Maintained by Mirko Peters (Microsoft MVP) · Last updated: