Spring Roo

01
Sep

Spring Roo and Aspect Oriented Programming (AOP)

Posted by anton as Spring Roo

You may have noticed that Spring Roo makes heavy use of AOP in the model layer. Naturally, you may be wondering if that is a good thing and whether it carries some performance cost.

Spring Roo and AOP

Spring Roo makes heavy use of AOP, because AOP allows for a cleaner separation between business logic and system logic. If done properly, it yields a more maintainable code which is easy to understand. Spring Roo uses AOP for transaction management and asynchronous operations.

No performance hit

There is no real performance hit, because AOP in Spring Roo’s case is compile-time weaved.

Disadvantages of AOP

Some disadvantages of AOP:

  • Lacking tool chain support – debuggers, profilers, and other tools may not be aware of AOP and treat the code as if the aspects had been weaved
  • Code bloat – small source can lead to larger than usual object code as it is “weaved” throughout the code base
  • Debugging and maintenance – just by looking at the code it is hard to tell when and what is getting called; during the debugging process you may be taken to places you do not expect