Wednesday, August 03, 2005

Aspect limits second time

Although this blog was opened six months ago, I've discovered its existence only recently. Interestingly, Charles' contribution little formalizes an idea I mentioned six months ago. When I wrote about AOP use-cases and its limits I didn't suspect that it's exactly what Charles means by an insufficient degree of freedom. AOP allows advice to be woven before, around or after a method call only. It does not offer the possibility of waving it into critical section entry or leaving or even into different branch instructions (if, switch, for, while, etc.).

If one intends to implement the same use-case - monitoring of locks acquiring and releasing via AOP - she has different possibilities whether she monitors Java built-in synchronized keyword or whether she waves into methods of the Java 5.0 API (the class java.util.concurrent.locks.Lock). In the former case, she fails; in the latter one, she can do it.