Java AOP (Using Aspect J)

Topics 

  • What is and Why AOP? 
  • AOP terminology 
  • AspectJ 
  • Spring AOP (covered in Spring course)

What is & Why AOP?

OOP Design is good but.. 

  • The OOP makes the code design more reusable and compact 
    • But, in some cases, it makes the code scattered in number of modules 
  • Examples 
    • Adding logging in each of class methods makes the logging code scattered in number of methods and classes. 
    • This makes code maintenance and update a tedious work.

Issues that do not get solved by OOP 

  • Code scattering 
    • Same concern spread across modules 
  • Code tangling 
    • Coupling of different concerns

AOP is the solution 

  • Aspect Oriented Programming(AOP) addresses these issues. 
  • Instead of adding the logging code in each of the methods, you delegate the logging functionality (concern) to an AOP container and specify which methods require logging applied. 
  • The container will call the logging aspect of the code when the methods are invoked on the proxy object returned by the Container.

You must have an active subscription to download PDF and Lab Zip of this course topic.Please click the "Subscribe" button or the "Login" button if you already have an account.

Subscribe     Login