views:

95

answers:

1

I'm doing research and one point I want to cover is "What is the relationship between Domain-driven Design and Aspect oriented programming?"

I know that a main principle in DDD is separation of concerns and I understand that. What I'm not really certain is, whether aspects in AOP acts like "sub domains" in our domain in DDD.

Are these two concepts, basically the same thing. I mean, If I develop an application following AOP and DDD, at the end of the day will it be true that "a sub domain" == "an aspect".

I will also appreciate any other opinions what is the common between AOP and DDD.

+5  A: 

One of the goals of DDD is to have a pure representation of your business logic that is not influenced by your infrastructure. A very powerful tool to accomplish this is AOP. I primarily use AOP for infrastructure sub domains like logging, caching, validation and exception handling. I don't typically use AOP for actual business logic however validation is kind of both infrastructure and business logic.

In the cases where AOP bleeds into business logic, I use attributes/annotations to call out the behavior. For other concerns, I'll use policy/configuration to apply aspects.

Michael Valenty