Aspect Oriented Programming (AOP)


Aspect Oriented Programming (AOP) complements Object-Oriented Programming (OOP) by providing another way of thinking about program structure. The key unit of modularity in OOP is the class, whereas in AOP the unit of modularity is the aspect. Aspects enable the modularization of concerns such as transaction management that cut across multiple types and objects [1].

What is Aspect Oriented Programming (AOP)?

Aspect Oriented Programming (AOP) is a programming paradigm that aims to increase modularity by allowing the separation of cross-cutting concerns. Cross-cutting concerns are the aspects of the program that can affect other concerns. These concerns often can’t 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. The separation of cross-cutting concerns happens by adding additional behavior to existing code without modifying the code itself, instead separately specifying which code is modified via a “pointcut” specificationas shown in figure \ref{fig__colon__figure1}. AOP forms a basis for Aspect Oriented software development. AOP includes programming methods and tools that support the modularization of concerns at the level of the source code. 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 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. Examples of crosscutting concerns include process synchronization, location control, execution timing constraints, persistence, and failure recovery. There is also a wide range of algorithms and design patterns that are more naturally expressible using AOP.

\label{fig:figure1} Modularizing cross-cutting concerns using Aspect Oriented Programming (AOP)

AOP has some concepts and terminology. Here are some of them: 
  • Aspect: a modularization of a concern that cuts across multiple classes. Transaction management is a good example of a cross-cutting concern.
  • Join point: a point during the execution of a program, such as the execution of a method