Tim Ewald recently blogged about some XSLT object model stuff, which was posted by Chris Sells for download from Chris’ blog. I love it when somebody whom I deeply respect discovers a technology that I’ve been advocating for years, in this case, the technology being aspect-oriented programming.
Tim will likely be somewhat shocked at the idea that he’s embraced AOP; it’s been something of a dirty word amongst the DevelopMentor-esque crowd for a half-decade now. But the brutal truth is, what he’s done–the execution of code in response to what amounts to a pointcut (through an XML document instead of through a programming model)–is quintessentially an AOP concept. All we need, I guess, is a standardized XPath language for navigating the structure of an AST, and we’ll all be in harmony, ya?
This simple equation defines the essence of an AOP system: pointcuts/queries + code. And the richer and more flexible your pointcut/query system, obviously the more powerful your AOP system. This is why simple interception, such as the CORBA interceptor, .NET/COM+ context-bound attribute interceptor or Java dynamic proxy, is not a rich AOP system in the slightest–although powerful, it uses only one sort of joint point, and that in itself inherently limits your abilities. Imagine if OOP only allowed just one base class or interface; how useful would OOP be?
As to the oft-quoted "killing blow" regarding AOP systems, that being that aspects cannot be ordered or stateful, it’s interesting to note that people refuse to make similar accusations about XSLT, yet it (a) fundamentally presents much the same kind of programming model as an AOP-based system would, and (b) has similar problems with ordering and state, yet nobody’s calling for XSLT to die….