Women in Technology

Hear us Roar



Article:
  Peeking Inside the Box: Attribute-Oriented Programming with Java 1.5, Part 1
Subject:   How about AOP
Date:   2004-07-29 05:01:28
From:   rharing
Interesting article however isnt this something you could have done with AOP instead? I havent programmed with AOP yet, but the articles that I've read about it would suggest that this could have been done with AOP instead? What do you think is the difference (if any) and the advantages of your approach?


Regards
Ronald

Main Topics Oldest First

Showing messages 1 through 1 of 1.

  • Don Schwarz photo How about AOP
    2004-07-29 18:43:38  Don Schwarz | [View]

    Absolutely. Aspect-Oriented Programming and Attribute-Oriented Programming are certainly closely related, and often complimentary, technologies. The fundamental difference is that Aspects focus on relocating code that cuts across multiple classes into a single location. That's certainly what I've done in this article.

    If your question was why did I use bytecode instrumentation versus a framework like AspectJ, then the answer is simple. Under the covers, almost all AOP frameworks use either source-code or bytecode instrumentation to "weave" the aspects through the code. In this article I wanted to dig a bit deeper and expose how some of that works, and demonstrate that although slightly complex, it's definitely an approachable subject.

    As mentioned in another comment, using CGLIB instead of BCEL would've simplified my examples considerably, because of CGLIB's built-in support for wrapping methods (like AspectJ's "around advice"). But again, I wanted to focus on the lowest level of details so you can see how something like this would work without direct JVM support for AOP.