Error handling as an aspect

  • Authors:
  • Fernando Castor Filho;Alessandro Garcia;Cecília Mary F. Rubira

  • Affiliations:
  • University of São Paulo, São Paulo, SP, Brazil;Lancaster University, Lancaster, UK;State University of Campinas, Campinas, SP, Brazil

  • Venue:
  • Proceedings of the 2nd workshop on Best practices in applying aspect-oriented software development
  • Year:
  • 2007

Quantified Score

Hi-index 0.00

Visualization

Abstract

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 exception 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.