Aspect Orientation

Aspect Orientation

In general, in enterprise applications development, if we use Object Oriented Programming languages then we have to provide the implementation by combining both Applications business logic and services logic.

public class Transaction{
   public void deposit(---){
      ----Deposit Logic-----
      ----Authentocation-----
      ----Logging------------
      ----Transact-----------
   }
   
   public void withdraw(---){
      ----Deposit Logic-----
      ----Authentication-----
      ----Logging------------
      ----Transact-----------
   }

   public void transfer(---){
      ----Deposit Logic-----
      ----Authentication-----
      ----Logging------------
      ----Transact-----------
   }
}

If we use the above style of implementation then we are able to get the following problems.

  1. It is very difficult to modify the services logic, it required to modify in all business method.
  2. It will not provide Sharability
  3. It will not provide Code Reusability.
  4. It will provide tightly coupled design.

To overcome the above problems we have to use Aspect Orientation. Aspect Orientation is not a programming language, it is a methodology or a paradigm, it will be applied on Object Oriented Programming in order to get loosely coupled design and in order to improve sharability and Reusability.

The basic idea behind Aspect Orientation is to separate all services logic from System Business logic , declaring each and every service as an aspect and injecting these aspects into the application Business logic in the respective locations by using Dependence Injection.

In enterprise Applications, AOP will provide the following advantages.

  1. In Enterprise applications, Business components looks very clean and having only business implementation statements.
  2. All Services are implemented in a common place which simplifies code maintenance.
  3. We can make changes in common location , so that, the changes are reflected to all business methods.

AOP is implemented by the following vendors.

  1. AspectJ
  2. Spring AOP
  3. JBOSS AOP

Spring Framework is providing the following two types of implementations

  1. Schema Based Implementation
  2. AspectJ
    • Declarative Based Approach
    • Annotation Based Approach

Aspect Orientation


Scroll to top