A Study on Exception Detection and Handling
Using Aspect-Oriented ProgrammingAspect-Oriented Programming (AOP) is intended to ease situations that involve many kinds of code tangling. This paper reports on a study to investigate AOP’s ability to ease tangling related to exception detection and handling. We took an existing framework written in Javaä, the JWAM framework, and partially reengineered its exception detection and handling aspects using AspectJä, an aspect-oriented programming extension to Java.
We found that AspectJ supports implementations that drastically reduce the portion of the code related to exception detection and handling. In the best case scenario, we were able to reduce that code by a factor of 4. We also found that AspectJ provides better support for different configurations of exceptional behaviors, more tolerance for changes in the specifications of exceptional behaviors, better support for incremental development, better reuse, automatic enforce-ment of contracts in applications that use the framework, and cleaner program texts. We also found some weaknesses of AspectJ that should be addressed in the future.