Aspect-Oriented Programming Refactoring

In my previous post I mentioned how there aren't any reliable refactoring tools for AOP yet. Seems like this problem is slightly more involved than the refactoring that most of us are used to. I have been reading a bunch of papers on this subject (mostly the top hits from the search for Aspect-Oriented Refactoring in Google Scholar.). The paper that best summarizes the problems and challenges is Aspect-Oriented Refactoring: Classification and Challenges by Jan Hannemann.

There are three main issues with refactoring aspects:

A fourth issue, I would like to add is being able to refactor from aspects to the normal OO constructs. Sometimes this might be desirable. For instance, an easier and more efficient refactoring to the code might be possible by first pushing the aspects back into normal code, perform some organization on that source code and then refactor into a new aspect.

Another paper - Refactoring of Aspect-Oriented Software - claims to have created a prototype to addresses the first bullet point above. However, I am not able to get a hold of their implementation which is a plug-in for Eclipse. The paper has identified the steps for each refactoring to be performed by hand (and also to be verified so that it behaves correctly). It is a good start and it is written along the lines of the first thesis on refactoring by William Opdyke.

Aspect-Oriented programming brings with it the interesting issue that it is no longer sufficient to treat the original source code as the only thing that matters. As programs evolve, they will be written with many different languages that are intertwined together. Each language will be complicated enough that it can be refactored to be made better but refactoring would also cause repercussions in other parts of the program. Solving (or at least getting a better understanding of the problem) from AOP refactoring will be useful when we have to deal with the same issue in domain-specific languages.

For good introductions to this topic, you can read part 1 and part 2 of the Aspect-Oriented Refactoring series.

comments powered by Disqus