Thursday, 21 April 2016

What are AOP basic concepts ?


Aspect
  • Cross-cutting functionality that you are implementing. 
  • Example: logging
    Logging is something that is required throughout an application. However, because applications tend to be broken down into layers based on functionality, reusing a logging module through inheritance does not make sense.
    However, you can create a logging aspect and apply it throughout your application using AOP.

Jointpoint
  • Point in the execution of the application where an aspect can be plugged in.
  • This point could be a method being called, an exception being thrown, or even a field being modified.
  • These are the points where your aspect’s code can be inserted into the normal flow of your application to add new behavior.

Advice
  • Advice is the implementation of an aspect. 
  • Advice is inserted into an application at joinpoints.

Pointcut
  • Something that defines at what joinpoints an advice should be applied.
  • Advices can be applied at any joinpoint that is supported by the AOP framework.
  • These Pointcuts allow you to specify where the advice can be applied.

Target
  • The class that is being advised.
  • The class can be a third party class or your own class to which you want to add your own custom behavior.
  • By using the concepts of AOP, the target class is free to center on its major concern, unaware to any advice that is being applied.

Proxy
  • A proxy is an object that is created after applying advice to a target object.
  • When you think of client objects the target object and the proxy object are the same.

Weaving
  • The process of applying aspects to a target object for creating a new proxy object is referred to as weaving.
  • These aspects are woven at the following specified joinpoints : 
    • Compile Time
    • Classload Time
    • Runtime

No comments:

Post a Comment

Note: only a member of this blog may post a comment.