Glen Martin follows Josh’s lead and leaves Sun Spring Aspect Container with AspectWerkz too
Jul 15

Dales “AspectJ in 2 paragraphs or less”

AOP, Tech Add comments

Dale has put together AspectJ in Two Paragraphs.

In this instance, we are researching the use of aspects to assist debugging an existing Java application. It has several different sources of data access and no single place in which to place logging or parameter setting logic. As such, we have found it very labor intensive to reliably search out all of those points and cut-and-paste the same code to every one of them. AspectJ allows us to define “pointcuts”, or semantically well-defined places, where the existing object-oriented code can be prepended to, appended to, or wrapped by, “advice”. Pointcuts and advice will allow us to consistently log all (diversely implemented) database accesses using only one definition (the aspect file). The advised code will add an identifier to every SQL statement in the application before it is executed by DB2. The advised code will also set the necessary JDBC parameters on every connection to enable additional tracing information produced by DB2. Because there is no editing of the actual codebase, the chance of code drift and bug introductions can be minimized. The chance that side-effects will be introduced into the codebase is almost non-existent since aspects cannot be directly referenced by Java classes. Aspects exist outside of existing code and, if they do not contain application logic themselves, can be selectively added or omitted during the Ant build.

I expected to hear about some cool marriage of AspectJ and JINI :)

Of course, Adrian Colyer did a great job of explaining AOP without the buzzwords.

One Response to “Dales “AspectJ in 2 paragraphs or less””

  1. Dion Says:

    I am looking forward to the combo! :)

Leave a Reply

Spam is a pain, I am sorry to have to do this to you, but can you answer the question below?

Q: What are the first four letters in the word British?