[aosd-discuss] Support for error handling by aspect-oriented programming

Mike Mortensen mmo at fc.hp.com
Thu Apr 19 10:34:53 EDT 2007


In an industry track paper for AOSD 2007, we discussed using AspectC++ to convert
the 'return code idiom' to exceptions and then use aspects to *also* handle the
exceptions.  We found in applying this to a C/C++ code base (12000 LOC) that
if we only converted the return codes that indicated errors to exceptions then
we had to 'scatter' try/catch blocks everywhere.

One challenge we found is that there are multiple strategies
for handling the exceptions( or originally the return code) that have different
control flows (return from caller of function, continue around function, etc.)
   Refactoring Idiomatic Exception Handling in C++:
   Throwing and Catching Exceptions with Aspects
by Mortensen and Ghosh (see http://www.aosd.net/2007/program/industry/index.php to download paper)

Dealing with the different control flows in pure C w/o exceptions would be more difficult
I think...


Also, Bruntink, van Deursen, D'Hondt', and Tourwe presented a paper in the AOSD 07
research track that also talked about handling the 'return code idiom' with aspects:
   Simple crosscutting concerns are not so simple: analysing variability in
   large-scale idioms-based implementations
http://portal.acm.org.ezproxy.hpl.hp.com/citation.cfm?id=1218586&coll=portal&dl=ACM&CFID=16851553&CFTOKEN=58086891

-Mike

> Hello,
> 
> The paper "On Typesafe Aspect Implementations in C++" 
> (http://www.aspectc.org/fileadmin/publications/etaps-sc-2005.pdf) by 
> Daniel Lohmann and Olaf Spinczyk shows an use case for the application 
> of AspectC++ for error checking. This document contains also a clear 
> description for the motivation where I'm also interested in to improve 
> software dvelopment.
> I am looking for a solution that can be completed besides the presented 
> Win32 API example.
> 
> 1. I imagine that it needs some adjustment if it will be extended for 
> the POSIX API because it won't be enough to filter on functions with a 
> non-void return type. How can functions be excluded that return an input 
> parameter as their result to enable call chaining?
> Examples:
> http://opengroup.org/onlinepubs/009695399/functions/strcpy.html
> http://opengroup.org/onlinepubs/009695399/functions/strcat.html
> 
> 2. Are any extensions for the pointcut expression syntax in the waiting 
> queue?
> 
> 3. Is a (free) library of helper functions or corresponding function 
> objects available?
> 
> 4. The following related information sources show also interesting 
> approaches.
> - "Error handling as an aspect" by Fernando Castor Filho, Alessandro 
> Garcia and Cecília Mary F. Rubira
>   http://doi.acm.org/10.1145/1229485.1229486
> 
> - Is the material from the talk "Aspectizing Design Patterns and 
> Exception Handling: The Devil is in the Details" by Alessandro Garcia 
> available online?
>   http://www.cs.ncl.ac.uk/research/events/colloquia/abstract.php?id=182
> 
> - 
> http://www.jpmdesign.net/wordpress/2005/08/27/ehi-error-handling-infrastructure/
> 
> 5. I guess that it will be a challenge to adapt such design options to 
> programming languages like C that do not support to throw and catch 
> exceptions as a built-in feature. Can this only be resolved with 
> implementations of metaobject protocols?
> 
> Regards,
> Markus
> 
> _______________________________________________
> discuss mailing list    -    discuss at aosd.net
> 
> To unsubscribe and change options, go to:
> http://aosd.net/mailman/listinfo/discuss_aosd.net
> 
> Check out the AOSD.net Wiki: http://aosd.net/wiki
> 




More information about the discuss mailing list