Thursday, April 16, 2009

Difference between Static AOP and Dynamic AOP

If you have none knowledge on aspect oriented programming you should continue this article to have a basic knowledge on the topic.

AOP is a complement of object oriented programming, not a compete. In few words, with aop, you can execute a code (called advice in aop termology) in a defined point (called joinpoint) during the execution of your application.

An example to joinpoint can be execution of a method. You can group a collection of all method calls in a particular package (so this was an example to pointcut, so group of joinpoints are called pointcut). 

The combination of advice (the code which is going to be executed on a joinpoints) and pointcuts are called aspect.

There are other termologies involved too but you got the basic idea. For example now you know that with aop you can select the methods (pointcuts) and configure your logging class to be invoked (advice) before and after each method call in your application. So you do not need to go each method and change those methods just to measure the time spent, you can achieve this more simply with aop. Also your methods will not contain code which is not related with their business.

Term weaving refers to the process of inserting aspects into the application code at the appropriate point. The difference of Static and Dynamic AOP occurs here.

In static aop, weaving occurs in compilation time. Thus means, the advices are included to compiled bytecode.

In dynamic aop, weaving occurs on the fly while bytecode is instrumented. So there are no any bytecodes related with aop in the compiled code, but they are added at runtime.

Static aop should perform better since there is no need to special handling in runtime. In the other hand dynamic aop is more flexiable becouse you do not need to re-compile your code when your aspects changes.

You may choose these links to do a hello world with aop:

Hello world with AspectJ (static aop): http://javatouch.googlepages.com/aspectjtutorial
Hello world with Spring AOP (dynamic aop): http://javatouch.googlepages.com/springaop-helloworld

5 comments:

  1. Replies
    1. The effectiveness of IEEE Project Domains depends very much on the situation in which they are applied. In order to further improve IEEE Final Year Project Domains practices we need to explicitly describe and utilise our knowledge about software domains of software engineering Final Year Project Domains for CSE technologies. This paper suggests a modelling formalism for supporting systematic reuse of software engineering technologies during planning of software projects and improvement programmes in Final Year Project Centers in Chennai.

      Spring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Spring Framework Corporate TRaining the authors explore the idea of using Java in Big Data platforms.
      Specifically, Spring Framework provides various tasks are geared around preparing data for further analysis and visualization. Spring Training in Chennai

      Delete
  2. Thanks for sharing an informative blog keep rocking bring more details.I like the helpful info you provide in your articles. I’ll bookmark your weblog and check again here regularly. I am quite sure I will learn much new stuff right here! Good luck for the next!
    web designer course in chennai
    web design development training in chennai
    web designing course with placement in chennai
    web design and programming courses in chennai
    web design and development training in chennai
    web designing courses in chennai
    web designing training and placement in chennai

    ReplyDelete
  3. awesome blog it's very nice and useful i got many more information it's really nice i like your blog styleweb design company in velachery

    ReplyDelete