More on Attribute Oriented Programming

A couple of my posts (here and here) on AOP have sparked a little bit of a discussion that I would like to clarify.  I had a minor rant about AOP being more then Attributes + Interception (as have others) and that people in our industry who present on the subject or write about it should do so in the context of the greater body of work presented by Gregor Kiczales and team because I believe that it is causing people to think of Aspects as a superset of Attributes which just isn't the case (i have heard this from a number of people). First of all, whether or not you prefer a static model or a dynamic model. Or if your implementation is Attributes + Interception without a pointcut composition model...i have no issue with that. My point was to help evolve how we think of AOP. Not the implementation model.

Tom Barnaby does some presenting on Attribute Oriented Programming and tries to touch on the AOP subject. He brought up a good point when he said that it's a bit like trying to describe OO with an encapsulation example. Tom. I couldn't agree more ;). It's a tough subject to spend a short amount of time on.

My experience in discussing AOP with people is interesting. Some people find it interesting and useful. Some found it interesting but not too useful and others could care less because it doesn't affect them in their day to day job.

My take is that cross-cutting concerns are already a big issue in the .Net world and it hugely affects production software. We have just become so accustomed to writing special code to handle concerns such as logging, security and transactions (design by contract too) that we get caught up looking at the trees and not the forest. So, to the people out there who don't believe it affects them. It does. It's just that the tools in the .Net world are still in their infancy and with respect to AOP we as a community are 1-2 years behind the java community. However in the next 12-24 months I bet we close the gap....imho.

-Mathew Nolton

Links on AOP

Feel free to send me good AOP links and I will add them to a list for later reference.

4 Comments

  • I'm working on a "Design by Contract" project (MS Thesis) in .NET and I'm trying to solve it by using AOP. I have looked at a bunch of Aspect Weavers for .NET (AspectC#, Weaver.NET, Loom.NET, AspectDNG, and few others) and it appears to me that none of them are ready to be used for a project.



    Do you know of any that would be stable enough to use? Or in your opinion which do you think will be the best to try and use?



    Thanks,

    Wes

  • Thanks for your input.



    As far as I can tell I think John Lam has given up the CLAW project.



    I have already starting looking into XCSharp and it looks pretty good, it is my best lead right now. I looked briefly at your framework and it looks interesting and may help me with part of my project, I will definitely take a closer look at it.



    Essentially what I'm working on is setting up an infrastructure/framework to setup pre/post/invariant type checks, very similar to your validation framework. Then I need to somehow create a method of turning on/off validation at runtime based on some configuration setting (i.e. no recompilation to turn on/off).



    My current idea is to use some kind of Aspect Weaver (maybe XCSharp) to generate two assemblies one with no validations and the other with validations. The original class will be left alone and the class in the second assembly will inherit form the original class (or maybe have a common interface not sure yet) and have all the validations in it. At compile time replace all calls to new for the original class that is marked with validations to a call to a factory method instead. Generate a factory method to match each of the constructors in the original class and have this factory method make a choice of which class to instantiate based on some configuration setting.



    There are still a bunch of details to work out but if I can get the above mentioned to work then I think I can get everything to work. My biggest problem right now is finding some kind of AOP implementation for .NET that can do this.



    Wes

  • i will have to download it and check it out. i wonder if the popular choices of AOP in .Net will be open source? I hope so.



    AspectJ set a nice precedence of community in its evolution. Hopefully the same will occur with .Net



    -Mathew Nolton

  • Thanks Igor,

    I will have to check out the AOP links on your site.

    -Mathew

Comments have been disabled for this content.