Java

Aspect-Oriented Programming (AOP) a paradigm introduction

And O’Reilly has a good introduction on AOP Aspect-Oriented Programming and JBoss actually for 2 months online already.

Aspect-oriented programming (AOP) is an exciting new paradigm that shall not compete but enhance the OOP.

The OOP weakness in applying common behavior that spans multiple non-related object models is where AOP comes in. AOP allows you to define cross-cutting concerns that can be applied across separate, and very different, object models. It allows you to layer ? rather than embed ? functionality so that code is more readable and easier to maintain.

Where the tools of OOP are inheritance, encapsulation, and polymorphism,

the components of AOP are advices/interceptors, introductions, metadata, and pointcuts. Wow… heard of it the first time today…

  • Advices/Interceptors: An advice is logic that is triggered by a certain event. It is behavior that can be inserted between a caller and a callee, a method invoker and the actual method. Advices are really the key to AOP. These constructs allow you to define the layers.
  • Introductions: are a way to add methods, fields or even interfaces to an existing class. Sounds like very reflection-heavy and allows runtime-modifications for generators or similar…
  • Metadata can be attached even during runtime to existing instances… this shall be added in Java 1.5 via JSR175
  • Pointcuts are the glue to hold above features together… the links and apply-rules are set with these.

WOW!

I am amazed…

Now go and read the great AOP Article for more samples and explanations than in my excerpt…

Average rating
(0 votes)

Similar entries