Aspect-oriented programming: Difference between revisions

Content deleted Content added
caps. link.
No edit summary
Line 9:
Aspect-oriented programming entails breaking down program logic into distinct parts (so-called ''concerns'', cohesive areas of functionality). Nearly all programming paradigms support some level of grouping and [[encapsulation (computer science)|encapsulation]] of concerns into separate, independent entities by providing abstractions (e.g., functions, procedures, modules, classes, methods) that can be used for implementing, abstracting and composing these concerns. Some concerns "cut across" multiple abstractions in a program, and defy these forms of implementation. These concerns are called ''cross-cutting concerns'' or horizontal concerns.
 
[[dataLogging logging(computing)|Logging]] exemplifies a crosscutting concern because a logging strategy must affect every logged part of the system. Logging thereby ''crosscuts'' all logged classes and methods.
 
All AOP implementations have some crosscutting expressions that encapsulate each concern in one place. The difference between implementations lies in the power, safety, and usability of the constructs provided. For example, interceptors that specify the methods to express a limited form of crosscutting, without much support for type-safety or debugging. [[AspectJ]] has a number of such expressions and encapsulates them in a special class, called an [[aspect (computer science)|aspect]]. For example, an aspect can alter the behavior of the base code (the non-aspect part of a program) by applying [[Advice in aspect-oriented programming|advice]] (additional behavior) at various [[join point]]s (points in a program) specified in a quantification or query called a [[pointcut]] (that detects whether a given join point matches). An aspect can also make binary-compatible structural changes to other classes, such as adding members or parents.