برمجة آسبكت
AOP terminology
We have seen some Problems with OOP ,
However ,Aspect-oriented programming(Aop) is an enhancement of OOP.In fact, AOP allows:
AOP terminology
We have seen some Problems with OOP ,
However ,Aspect-oriented programming(Aop) is an enhancement of OOP.In fact, AOP allows:
- The modularization of crosscutting concerns by its constructs.
- The uncoupling of the modules
=> Using aspects, the removal of dependence of a crosscutting concern from the modules that use it.
AOP
|
OOP
|
the crosscutting functionalities are extracted from the object-oriented implementations and applied as advices | the crosscutting concerns are included into the classes' implementations |
What's advice?
-it's a job of an aspect .
=>it defines both the what and the when of an aspect
=>it addresses the question of when to perform the job.
Spring aspects can work with five kinds of advice :
1)Before(advice functionality takes place before invocate
2)After(advice functionality takes place After method complete regardless of the outcome.)
3)After-Returning : advice functionality takes place after the advised method successfully completes.
4)After-throwing:advice functionality takes place after the advised method throws an exception.
5)Around:Adivce wraps(emballer) the adviced method(Before&After)
What's a JointPoints?
-it's opportunities for advice to be applied.
-it's opportunities for advice to be applied.
*This point could be :
1)a method being called,
2)an exception being thrown,
3)a field being modified.
==> There are 3 places where aspect’s code can be inserted into the normal flow of th application to add new behavior.
What's a PointCut?
If advice defines the what and when of aspects, then pointcuts define the where.
-pointcut definition matches one or more join points at which advice should be woven.
-to specify these pointcuts ,using :
1)explicit class and method names
or
2)regular expressions that define matching class and method name patterns
An aspect is the merger of advice and pointcuts.
=>what it does and where and when it does it.
INTRODUCTIONS : allows you to add new methods or attributes to existing classes.
WEAVING :
the process of applying aspects to a target object to create a new proxied
object.
-The weaving take place at several points in the target object’s lifetime:
1)Compile time:Aspects are woven in when the target class is compiled.
=>The weaver is AspectJ’s weaving compiler .
2)Classload time:Aspects are woven in when the target class is loaded into the JVM.
=> AspectJ 5’s load-time weaving (LTW) supports this Weaving.
3)Runtime:Aspects are woven in sometime during the execution of the application.
- How Spring AOP aspects are woven ?
an AOP container will dynamically generate a proxy object that will delegate to the target object while (durant) weaving in the aspects.
In Brief :
1)ADVICE:( Java Code)contains the cross-cutting behavior that needs to be applied to an application’s objects.
2)JointPoints: are all the points within the execution flow of the application that are candidates to have advice applied.
3)pointcut :(XML Code)defines where (at what join points) that advice is applied.
==>Pointcuts define which join points get advised.
Most Dominants AOP FrameWorks :
1. AspectJ (http://eclipse.org/aspectj)
2. JBoss AOP (http://www.jboss.org/jbossaop)
3. Spring AOP (http://www.springframework.org)
2. JBoss AOP (http://www.jboss.org/jbossaop)
3. Spring AOP (http://www.springframework.org)
NOTE:
> Spring Classic AOP => Working directly with ProxyFactoryBean.
> AspectJ now supports annotation-based aspects.
> Spring Classic AOP => Working directly with ProxyFactoryBean.
> AspectJ now supports annotation-based aspects.
Awesome article. It is so detailed and well formatted that i enjoyed reading it as well as get some new information too.
ReplyDeleteDevops Training courses
Devops Training in Bangalore
Best Devops Training in pune
Microsoft azure training in Bangalore
Power bi training in Chennai
Great content thanks for sharing this informative blog which provided me technical information keep posting.
ReplyDeletepython Training institute in Chennai
python Training institute in Bangalore
python Training in Pune
I do agree your blog for quiz programming concepts, which is very helpful to grow up your knowledge. keep sharing more.
ReplyDeleteangular js training in chennai
angular js training in tambaram
full stack training in chennai
full stack training in tambaram
php training in chennai
php training in tambaram
photoshop training in chennai
photoshop training in tambaram
Excellent post, From this post i got more detailed information,
ReplyDeleteThanks to share with us,
web designing training in chennai
web designing training in porur
digital marketing training in chennai
digital marketing training in porur
rpa training in chennai
rpa training in porur
tally training in chennai
tally training in porur
Wow it is really wonderful and awesome thus it is veWow, it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot.
ReplyDeleteangular js training in chennai
angular js training in omr
full stack training in chennai
full stack training in omr
php training in chennai
php training in omr
photoshop training in chennai
photoshop training in omr