aoppolicy-injection

Errors in Aspect Oriented Programming with Policy Injection


When using Aspect Oriented Programming with Policy injection, how do you deal with policy errors gracefully in your design?

In Aspect Oriented Programming the objects should be unconcerned with how a particular policy is configured, but a particular policy may throw particular errors. What's the most graceful design to deal with that?


Solution

  • If you consider the policy to be an "aspect" of the system then the specific aspect should handle everything that has to do with that policy. The objects should be unaware of the specific policy. This way, if you you need to change the policy in the future, you won't need to change anything in the objects.