AOP for Inter-Application Variation!
Today, Dave Ross made some very interesting comments on the CFCDev list based on a suggestion by Adam Haskell which opened my eyes to a whole new family of use cases for leveraging AOP in application design . . .
Implementing AOP in CF using mixins
Usually the most profound ideas are sleepers. They don’t sound like much when you first hear about them. Sean made a comment about methods during his Duck Typing presentation last week that I think we may still be finding new uses for this time next year.
He said that in ColdFusion, methods are "first order citizens". What does this mean? It means you can perform operations on them in the same way you can perform operations on attributes (although the permissible operations will be constrained by the value type – I doubt you could multiply two methods!).
What can we use this for? Ask me this time next year, but one example of the breadth of uses for this would be to implement Aspect Oriented Programming using an in-class decorator.
How ColdSpring Implements AOP using a Decorator
During the AOP BOF session last week at CF United, he explained how he’d implemented AOP using a decorator. It’s a great example of a practical use of the design pattern and may be a good primer for anyone who wants to consider other ways of implementing AOP in CF.




