tags:

views:

260

answers:

5

I'm stumped as to why adoption of AO has been so slow. There are plenty of rich implementations out there for the predominant languages. My guess is that, like OO in it's day, it is enough of a paradigm shift that people don't recognize the places where it could be helping them.

So, beyond non-invasive logging, what are some of the ways that you have used, or plan to use AO, that reduces complexity, improves maintenance, enhances system "ilities"?

+2  A: 

Transaction management. I know it's a canonical use of AOP, but it really does shine when used for that.

And while I haven't had an opportunity to use it in a real-world situation, I see "around-advice" as being INCREDIBLY powerful, in particular for the value it adds to simplify the complexity of code by removing the need for many checks for rare conditions.

McWafflestix
A: 

In my experience, with Spring AOP seems to be pretty common.

I think the difficulty is that people are just not used to thinking in terms of aspects, and weaving code in, even at compile time, can be somewhat scary, as it is harder to see what is actually affecting each method, for example, esp if you use a mixture of weaving at compile-time and run-time.

I have used it in situations where I have one controller, and I add in whether it is a servlet or webservice, for example. I have also used it to abstract out the database, so the database connections and database-optimized queries, could be woven into the application.

James Black
+1  A: 

I agree for Spring AOP.

AOSD (we no longer speak about AOP I don't exactly why) is really useful for middleware/service oriented architecture where you already have, by design, some modularity.

I've used it in this context for telephony services with some really limited billing service.

I've also used it to build a kind of modular interpreter/compiler in order to perform some analysis around some code.

To my mind, one problem are the pointcut languages that could be sometimes tricky to describe exactly where you want to apply your advice. Another problem is composition, I don't know if it's been solved but it could be difficult to understand when you order your advices....

LB
+1  A: 

AOP is common, except people rarely call it AOP. Look at all the places in .NET programming where attributes are used. Attributes are essentially cross-cutting behaviors that can apply across many classes/methods/parameters.

More recently, the ASP.NET MVC platform has adopted heavy use of attributes, for a wide range of cross-cutting components such as security, data binding, and exception handling.

DSO
So what would be a real world example of attributes that illustrate that?
Chris Noe
E.g. in ASP.NET MVC, you can tag a Controller class or method with [Authorize] attribute, and the framework will ensure that invoking the controller triggers the authorization to take place (e.g. redirecting to login page). There are many others...
DSO
+1  A: 

I am currently using AOP via EntLib / Unity in production for:

  • logging
  • caching
  • security
  • exception reporting
  • performance counters

Take a look at http://www.agileatwork.com/unit-of-work-with-unity-and-aspnet-mvc/ for an implementation of the unit of work pattern with AOP

[UnitOfWork]
public void Process(Job job)
{
    ...
}
Michael Valenty