Aspects and Policy Injection - Clean Up Your Code

· November 7, 2008

The other thing that really impressed me this week was the use of policy injection and aspect-oriented programming in our code.

I mean, you write aspects (or policies) for things like logging, performance counters, caching, and error handling, and move all that stuff into configurable policies. What is left in your code?

Pure and beautiful business code (or at least problem domain code).

It’s so nice - we’re cleaning up code every day in our project, and I just love to remove logging and error handling from my code and see my business code emerge from the muddy waters of “cross-cutting concerns”.

This video opened my eyes to aspects. It’s for PostSharp, which is another framework for doing aspects, but the concepts are shown clearly.

Twitter, Facebook