Aspect Oriented Refactoring

From AspectOrientedProgramming:

Question: How does AOP interact with (regular) refactoring? Most refactorings involve moving code across method boundaries, but when aspect code is potentially triggered on any method invocation, then such refactorings are no longer behaviour-preserving.-- AndersMunch

Answer: You can improve the structure of code without changing its behavior by refactoring procedural or object-oriented code into aspect-oriented advice, called at the appropriate point cuts.

Doesn't answer the question. Take for example the ExtractMethod refactoring. If the new method you create is on a point cut, you have changed the behaviour of the program. ExtractMethod, which used to be a completely mechanical behaviour-preserving transformation, is that no longer. Hence my question: Doesn't AOP complicate doing good old non-AOP Fowler-book refactorings? --AndersMunch


The Aspect-Oriented Refactoring Series, on The Server Side. An example of RefactorExtractMethodCallsToAspect:


See also:


CategoryRefactoring CategoryAspectOrientation


EditText of this page (last edited November 20, 2014) or FindPage with title or text search