*ColdSpring Mad Science: Injecting Metadata for use in AOP and Proxy Generation
http://www.briankotek.com/blog/index.cfm/2007/7/12/ColdSpring-Mad-Science-Injecting-Metadata-for-use-in-AOP-and-Proxy-Generation
Thanks,
Jamie
An important concept in AOP is that any code making calls to objects
subject to weaving should be unaware of what advice (if any) is being
woven. Among other things, this means that a caller can assume that the
type of a value returned from a method call is compatible with the
method's declared returntype. It is quite OK for advice to substitute a
different value of the same type or even an object that is a subclass of
the returntype, but returning a completely different type altogether is
bound to break any code written to call the method before the advice was
woven into it.
Data conversion is more of the realm of the adapter pattern. I recently
found an excellent application of the adapter pattern to handle Flex
data conversion issues within Mark Mandel's Conduit project:
http://www.compoundtheory.com/?action=displayPost&ID=385
The cool thing about Conduit is how it allows you to extend the invoker,
serialiser and deserialiser. For instance, the default invoker simply
instantiates the "source" argument as a CFC and calls the methodName
with given params. One simple step up from the default invoker is one
that uses the "source" argument as a bean name and calls getBean() on a
ColdSpring factory.
If you wanted to do custom data conversion of return values for Flex,
the serialiser in Conduit would be a great place to do it.
Cheers,
-- Dennis
I'm writing up the doco slowly at the moment, but you can also now
apply filters to invokers, serialisers and deserialisers - so if you
want to apply combinations of data transformations or apply them under
different conditions, you can do so in a loosely coupled way very
easily, that than just having to replace the base CFCs.
Mark
On Mon, Mar 2, 2009 at 5:36 AM, Dennis Clark <boom...@gmail.com> wrote:
>
>
> Data conversion is more of the realm of the adapter pattern. I recently
> found an excellent application of the adapter pattern to handle Flex
> data conversion issues within Mark Mandel's Conduit project:
>
> http://www.compoundtheory.com/?action=displayPost&ID=385
>
> The cool thing about Conduit is how it allows you to extend the invoker,
> serialiser and deserialiser. For instance, the default invoker simply
> instantiates the "source" argument as a CFC and calls the methodName
> with given params. One simple step up from the default invoker is one
> that uses the "source" argument as a bean name and calls getBean() on a
> ColdSpring factory.
>
> If you wanted to do custom data conversion of return values for Flex,
> the serialiser in Conduit would be a great place to do it.
>
While I would say that is true for standard AOP proxy methods, I don't agree when it comes to remote object methods. I don't think the analogy is exact, but when necessary a remote proxy can indeed be thought of as an implementation of the Adapter pattern.