In
aspect-oriented software development, cross-cutting concerns are
aspects of a
program
Program, programme, programmer, or programming may refer to:
Business and management
* Program management, the process of managing several related projects
* Time management
* Program, a part of planning
Arts and entertainment Audio
* Programm ...
that affect several
modules, without the possibility of being
encapsulated in any of them.
These
concerns often cannot be cleanly
decomposed from the rest of the system in both the design and implementation, and can result in either ''scattering'' (
code duplication), ''tangling'' (significant dependencies between systems), or both.
For instance, if writing an
application for handling
medical records
The terms medical record, health record and medical chart are used somewhat interchangeably to describe the systematic documentation of a single patient's medical history and care across time within one particular health care provider's jurisdi ...
, the indexing of such records is a
core concern
Core or cores may refer to:
Science and technology
* Core (anatomy), everything except the appendages
* Core (manufacturing), used in casting and molding
* Core (optical fiber), the signal-carrying portion of an optical fiber
* Core, the central ...
, while
logging a history of changes to the record database or user database, or an authentication system, would be cross-cutting concerns since they interact with more parts of the program.
Background
Cross-cutting concerns are parts of a program that rely on or must affect many other parts of the system. They form the basis for the development of
aspects.
Such cross-cutting concerns do not fit cleanly into
object-oriented programming or
procedural programming
Procedural programming is a programming paradigm, derived from imperative programming, based on the concept of the ''procedure call''. Procedures (a type of routine or subroutine) simply contain a series of computational steps to be carried ...
.
Cross-cutting concerns can be directly responsible for ''tangling'', or system inter-dependencies, within a
program
Program, programme, programmer, or programming may refer to:
Business and management
* Program management, the process of managing several related projects
* Time management
* Program, a part of planning
Arts and entertainment Audio
* Programm ...
. Because procedural and
functional language constructs consist entirely of procedure calling, there is no semantic through which two goals (the capability to be implemented and the related cross-cutting concern) can be addressed simultaneously.
As a result, the code addressing the cross-cutting concern must be ''scattered'', or duplicated, across the various related locations, resulting in a loss of
modularity
Broadly speaking, modularity is the degree to which a system's components may be separated and recombined, often with the benefit of flexibility and variety in use. The concept of modularity is used primarily to reduce complexity by breaking a sy ...
.
Aspect-oriented programming
In computing, aspect-oriented programming (AOP) is a programming paradigm that aims to increase modularity by allowing the separation of cross-cutting concerns. It does so by adding behavior to existing code (an advice) ''without'' modifying ...
aims to
encapsulate cross-cutting concerns into
aspects to retain modularity. This allows for the clean isolation and reuse of code addressing the cross-cutting concern.
By basing designs on cross-cutting concerns,
software engineering benefits can include modularity and simplified maintenance.
Examples
Examples of concerns that tend to be cross-cutting include:
*
Business rule A business rule defines or constrains some aspect of business. It may be expressed to specify an action to be taken when certain conditions are true or may be phrased so it can only resolve to either true or false. Business rules are intended to ass ...
s
*
Caching
*
Code mobility
In distributed computing, code mobility is the ability for running programs, code or objects to be migrated (or moved) from one machine or application to another. This is the process of moving mobile code across the nodes of a network as opposed ...
*
Data validation
In computer science, data validation is the process of ensuring data has undergone data cleansing to ensure they have data quality, that is, that they are both correct and useful. It uses routines, often called "validation rules", "validation cons ...
* Domain-specific
optimizations
*
Environment variables
An environment variable is a dynamic-named value that can affect the way running processes will behave on a computer. They are part of the environment in which a process runs. For example, a running process can query the value of the TEMP en ...
and other global configuration settings
*
Error detection and correction
In information theory and coding theory with applications in computer science and telecommunication, error detection and correction (EDAC) or error control are techniques that enable reliable delivery of digital data over unreliable communi ...
*
Internationalization and localization which includes
Language localisation
Language localisation (or language localization) is the process of adapting a product's translation to a specific country or region. It is the second phase of a larger process of product translation and cultural adaptation (for specific countries ...
*
Information security
Information security, sometimes shortened to InfoSec, is the practice of protecting information by mitigating information risks. It is part of information risk management. It typically involves preventing or reducing the probability of unauthoriz ...
*
Logging
*
Memory management
*
Monitoring
Monitoring may refer to:
Science and technology Biology and healthcare
* Monitoring (medicine), the observation of a disease, condition or one or several medical parameters over time
* Baby monitoring
* Biomonitoring, of toxic chemical compounds, ...
*
Persistence
*
Product features
*
Real-time constraints
*
Synchronization
Synchronization is the coordination of events to operate a system in unison. For example, the conductor of an orchestra keeps the orchestra synchronized or ''in time''. Systems that operate with all parts in synchrony are said to be synchronou ...
*
Transaction processing
*
Context-sensitive help
*
Privacy
*
Computer security
See also
*
Separation of concerns
In computer science, separation of concerns is a design principle for separating a computer program into distinct sections. Each section addresses a separate '' concern'', a set of information that affects the code of a computer program. A concern ...
*
Aspect-oriented programming
In computing, aspect-oriented programming (AOP) is a programming paradigm that aims to increase modularity by allowing the separation of cross-cutting concerns. It does so by adding behavior to existing code (an advice) ''without'' modifying ...
*
Code refactoring
In computer programming and software design, code refactoring is the process of restructuring existing computer code—changing the '' factoring''—without changing its external behavior. Refactoring is intended to improve the design, structu ...
(restructuring software)
*
Database normalization (minimize needlessly replicated data)
*
Multiple inheritance
Multiple inheritance is a feature of some object-oriented computer programming languages in which an object or class can inherit features from more than one parent object or parent class. It is distinct from single inheritance, where an object or ...
*
Microservices
A microservice architecture – a variant of the service-oriented architecture structural style – is an architectural pattern that arranges an application as a collection of loosely-coupled, fine-grained services, communicating through lightw ...
*
Orthogonalization
In linear algebra, orthogonalization is the process of finding a set of orthogonal vectors that span a particular subspace. Formally, starting with a linearly independent set of vectors in an inner product space (most commonly the Euclidean s ...
(mathematical normalization)
References
Bibliography
*
*
*
*
*
Further reading
*Laddad, R. (2003): AspectJ in Action, Practical Aspect-Oriented Programming, Manning Publications Co.
External links
AOSD.net'sglossary of
aspect oriented terms (vi
Internet Archive Wayback Machine AOSD.net has becom
Modularity.
*
AspectJ
AspectJ is an aspect-oriented programming (AOP) extension created at PARC for the Java programming language. It is available in Eclipse Foundation open-source projects, both stand-alone and integrated into Eclipse. AspectJ has become a widely use ...
br>
an Aspect-Oriented extension to the
Java (programming language), Java programming language
*Bergmans, L., M. Aksit (2001): Composing Multiple Concerns Using Composition Filters, https://web.archive.org/web/20170909131212/http://trese.cs.utwente.nl/ (24 July 2004)
*Berg, K. van den, Conejero, J. and Chitchyan, R. (2005). AOSD Ontology 1.0 ‐ Public Ontology of Aspect‐Orientation. AOSD Europe Network of Excellence, http://eprints.eemcs.utwente.nl/10220/01/BergConChi2005.pdf
*Here is an example of handling a cross-cutting concern: https://web.archive.org/web/20161220151503/https://www.captechconsulting.com/blogs/a-persistence-pattern-using-threadlocal-and-ejb-interceptors
{{aosd
Aspect-oriented software development
Aspect-oriented programming