Craig blogged a response to my AOP post refuting the idea that AOP is in any way useful. Err, let’s see if I get this right:
This is so full of holes you could strain your pasta through it. It’s a classic case of overgeneralization, and in and of itself that’s enough to render his argument moot. However, I’d like to examine it in slightly more detail.
Well, hey, at least he thinks they’re little holes, right? 😉
(Craig’s a friend, so while I feel no abrasion at the "tough love" approach to his response, neither do I feel any compulsion to be nice in return, so…. *ding* Round Two!)
Ted’s basic argument is that since XSLTO uses declarative attributes to drive execution of code, and since AOP is based around more or less the same thing, that the two are equivalent. I disagree: XSLTO is a proper subset of what AOP advocates. It is a specific, specialized utilization of declarative programming. In this case, it’s essentially a translation of XSLT into the C# realm, giving you the ability to process XML documents via recursive descent.
Well, aside from the double usage of the term "specific", I don’t disagree with what Craig suggests, except that the idea of using a subset of AOP is somehow not doing AOP. If I create "things" that contain both state and behavior, yet don’t support operator overloading, am I writing an object? The act of using a subset of the AOP feature set is the first step towards AOP–after all, look at the degree of success (COM+ and EJB being two of the most notable successes, CORBA and Java dynamic proxies coming shortly thereafter) enjoyed by using just the simplest pointcut (interception) and the ability to weave code around it.
Craig later "dissects" my argument regarding inheritance and OO by suggesting that
I don’t miss multiple inheritance in C#, despite it being a mainstay of C++. Adding more constructs to the language adds complexity, and that complexity adds cognitive overhead that can make the tool less useful in many situations. We have this conversation on the FlexWiki mailing lists all the time: people are constantly proposing extensions to the wiki syntax that bring it closer and closer to doing everything HTML can do. Of course, at some point you cross the line where you have to wonder why you should bother with having a wiki language at all? It’s like Spider Man taught us: with great power comes great responsibility.
I didn’t say "multiple implementation inheritance", I said "multiple inheritance", as in, how useful would you find C# without the ability to inherit from a base class or one or more interfaces? I submit you wouldn’t be programming in C# or C++ if this were the case.
Craig later says,
Just like XSLTO and AOP, XSLT is a specialized tool useful for a few very narrow problems. And just like XSLTO and AOP, it should be viewed as – although perhaps not a last resort – something you only pull out when you have a specific need, not a general-purpose tool. … At the end of the day, I guess what Ted and I disagree on is the extent to which AOP concepts are useful. I say, ?very little, but not zero?, and he takes a view that is presumably much broader than that. I view XSLTO as a useful replacement for some of what XSLT does. And I view XSLT as a useful replacement for some of what the .NET XML APIs do. But most of the time I’m going to stick with my favorite API, XmlSerializer, and stay the hell away from frameworks that drive execution via declarative means. I take the same attitude towards (other) AOP frameworks: I’ll use them when I’ve exhausted other options, and not before.
That’s fine, Craig–take the drug in small doses if you must. Just remember, the first hit’s free, kid…. 😉