AOP is a programming paradigm that aims to increase modularity by allowing the separation ofcross-cutting concerns. AOP forms a basis for aspect-oriented software development.
Standard terminology used in Aspect-oriented programming may include:
- Cross-cutting concerns
- Even though most classes in an OO model will perform a single, specific function, they often share common, secondary requirements with other classes. For example, we may want to add logging to classes within the data-access layer and also to classes in the UI layer whenever a thread enters or exits a method. Even though each class has a very different primary functionality, the code needed to perform the secondary functionality is often identical.
- This is the additional code that you want to apply to your existing model. In our example, this is the logging code that we want to apply whenever the thread enters or exits a method.
- This is the term given to the point of execution in the application at which cross-cutting concern needs to be applied. In our example, a pointcut is reached when the thread enters a method, and another pointcut is reached when the thread exits the method.
- The combination of the pointcut and the advice is termed an aspect. In the example above, we add a logging aspect to our application by defining a pointcut and giving the correct advice.
ImplementationAOP programs can affect other programs in two different ways, depending on the underlying languages and environments:
The difficulty of changing environments means most implementations produce compatible combination programs through a process known as weaving - a special case of program transformation. An aspect weaver reads the aspect-oriented code and generates appropriate object-oriented code with the aspects integrated. The same AOP language can be implemented through a variety of weaving methods, so the semantics of a language should never be understood in terms of the weaving implementation. Only the speed of an implementation and its ease of deployment are affected by which method of combination is used.
- a combined program is produced, valid in the original language and indistinguishable from an ordinary program to the ultimate interpreter
- the ultimate interpreter or environment is updated to understand and implement AOP features.