Aspect Oriented Programming is sensibly new and it is not a replacement for Object Oriented Programming. In fact, AOP is another way of organizing your Program Structure.
To be more clear I will use some diagrams:
What is Aspect?
|---------------------|------------------|------------------|
| Aspect = Point cut + Advice |
|---------------------|------------------|------------------|
| | Where the aspect | What code is |
| | is applied | executed. |
|---------------------|------------------|------------------|
Aspect = Point cut + Advice
Type of Advice methods
Aspect Example
@Around( "execution(* *(..))" )
public Object trace(ProceedingJoinPointproceedingJP)throwsThrowable{
String methodInformation= proceedingJP.getStaticPart().getSignature().toString();
logger.trace("Entering "+methodInformation);
try{
returnproceedingJP.proceed();
} catch(Throwable ex) {
logger.error("Exception in "+methodInformation, ex);
throw ex;
} finally {
logger.trace("Exiting "+methodInformation);
}
}