What is a good example of a cross-cutting concern
? The medical record example on the wikipedia page seems incomplete to me.
Specifically from this example, why would logging lead to code duplication (scattering)? (Besides simple calls such as log("....")
everywhere, which doesn't seem like a big deal).
What is the difference between a core concern
and a cross-cutting concern
?
My end goal is to get a better understanding of AOP.
Before understanding the Crosscutting Concern, we have to understand the Concern.
A Concern is a term that refers to a part of the system divided on the basis of the functionality.
Concerns are two types:
This figure represents a typical application that is broken down into modules. Each module’s main concern is to provide services for its particular domain. However, each of these modules also requires similar ancillary functionalities, such as security logging and transaction management. An example of crosscutting concerns is "logging," which is frequently used in distributed applications to aid debugging by tracing method calls. Suppose we do logging at both the beginning and the end of each function body. This will result in crosscutting all classes that have at least one function.