Error handling as an aspect

Fernando Castor Filho, Alessandro Garcia, Cecília Mary F. Rubira
2007 Proceedings of the 2nd workshop on Best practices in applying aspect-oriented software development - BPAOSD '07  
One of the fundamental motivations for employing exception handling in the development of robust applications is to lexically separate error handling code from the normal code so that they can be independently modified. However, experience has shown that exception handling mechanisms of mainstream programming languages fail to achieve this goal. In most systems, exception handling code is interwined with the normal code, hindering maintenance and reuse. Moreover, because of limitations in the
more » ... ception handling mechanisms of most mainstream programming languages, error handling code is often duplicated across several different places within a system. In this paper we present a pattern, Error Handling Aspect, which leverages aspect-oriented programming in order to enhance the separation between error handling code and normal code. The basic idea of the pattern is to use advice to implement exception handlers and pointcuts to associate advice to different parts of the normal code in order to improve the maintainability of the normal code and promote reuse of error handling code.
doi:10.1145/1229485.1229486 fatcat:lsdpg67a2fghxcdklowa3n6rgy