One of the questions which raised in the TechEd BOF session was about the possibilities to improve exception management with AOP. Let's take Microsoft Exception Management Application Block for .NET as example. This building block provides ExceptionManager and a set of different publishers (you can write the exception to file, windows event log, send it per email etc...).
If you use this exception block you have to catch the exceptions you want to publish and use the exception manager (a good place for doing this is a component or service boundary):
3: // Core concern of the method.
5: catch ( Exception ex )
7: ExceptionManager.Publish( ex );
The problem is that you have to write this chunk of code into every method which uses the exception manager (crosscutting concern). This is not very elegant, and can be easily forgotten. With AOP, you would define a join point on exception and separate the exception management from core concern (AspectJ-like pseudo code:)
1: // Pointcut - AspectJ-Like
2: pointcut exceptionHandler(Exception e): handler(Exception+) && args(e);
4: // advice for exception management
5: after(Exception e): exceptionHandler(e)
7: ExceptionManager.Publish (e)
[1] Microsoft Exception Management Application Block
[2] Swarr, R. Make your Apps Operations Friendly with AOP
[3] Ugurlu Ergün, Nichts geht mehr und Spass dabei, Fehlerbehandlung mit AOP