James suggested I blog on the core difference between DynAOP and AspectWerkz after I quipped in his blog, and I am a sucker for a request, so here goes.
First some definitions, these won't be precise, but they should convey the ideas as they are in use in java open source AOP at the moment: Advice represents code that should modify the behavior or properties of existing code. An interceptor or mixin would be a common example of advice. Pointcuts specify points in code. A typical pointcut might be "any invocation of a method named 'execute' on a class implementing the Action interface." Weaving is a terrible name for the process of combining Poiuntcuts and Advice. Advice is applied to a Pointcut forming an aspectified thingie =)
Aspectwerks and AspectJ do this by bytecode manipulation. They typically modify the bytecode (or sourcecode) of java classes directly so that advice (or hooks for advice) is woven in directly. They may do this as a compile step, or may do this at classload time, the difference is moot. The aspecty stuff is mixed directly into the bytecode.
DynAOP, Nanning, and Rickard's Mysterious Project (reportedly -- no one has actually seen it yet ;-) use a different approach where all aspectified classes are proxied (via a java.reflect.DynamicProxy
or CGLIB proxy) and the weaving is done at the proxy, not on the base instance -- the bytecode is unchanged. The drawback is that you have to specifically wrap an instance and talk to the proxy rather than being able to work with whatever is returned by the new
magic.