Can someone explain AOP concepts for dummies: join point, point cut, weaving etc.
For example: Aspect: a modularization of a concern that cuts across multiple classes. What does that mean?
Software Engineering Stack Exchange is a question and answer site for professionals, academics, and students working within the systems development life cycle. It only takes a minute to sign up.Sign up to join this community
Think of a concern as a functionality group e.g. logging, auditing, security
These functionalities are ever present in most code, but they don't really live in our animal->dog classes - they are functionality that should live in many classes - they are cross cutting concerns.
A Joinpoint is a place in the code where the aspect code is actually ran.
A pointcut is how to say what code runs at the jointpoint.
Weaving - is when the compiler/system takes your normal code and includes all the AOP code so that it triggers the correct code etc - can think of this as an extra pre-compile step.
A simple understandable example is:
Please be aware that terminology differs slightly between different implementations and AOP frameworks.
Each definition builds on the previous ones.
Something that bothers you (concern) everywhere (cross-cutting) across you application. e.g logging or security
A chunk of code that is automatically added before, after, or both (around) your existing code
Application code | | | | \|/ | JoinPoint ----------->("before" aspect, on the way in) // just before your intercepted application code Pointcut start--------> public String myMethod(params ...) //your application code Pointcut finish--------> return (foo) JoinPoint ----------->("after" aspect, on the way out) // just after your intercepted application code | \|/ | | | Application code
A place in code execution where part of the aspect execute.
The point where your aspect "joins" the pointcut. At a "before" joinPoint you will have access to parameters, at "after" joinPoint you will have access to the return value. If an exception is thrown, you may need a "try-catch-finally" to handle or re-throw it.
The process of adding aspects around a pointcut
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?